home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1990 September: Essentials 4 / ADC Developer CD (1990-09) [Essentials 4]_iso / Developer Essentials 4.iso / d e v e l o p / develop 1 code / Compatibility / Sample.c < prev    next >
MacBinary  |  1989-10-16  |  31.0 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Mon Oct 16 17:20:15 1989, modified Mon Oct 16 17:20:15 1989, creator 'MPS ', type ASCII, 31161 bytes "Sample.c" , at 0x7a39 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 63 00 00 00 00 00 00 |..Sample|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 40 01 00 00 |.TEXTMPS| ...@...|
|00000050| 00 00 00 00 00 79 b9 00 | 00 01 7e a1 5f f6 8f a1 |.....y..|..~._...|
|00000060| 5f f6 8f 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |_.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 d1 43 00 00 |........|.....C..|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000d0| 0d 23 0d 23 09 41 70 70 | 6c 65 20 4d 61 63 69 6e |.#.#.App|le Macin|
|000000e0| 74 6f 73 68 20 44 65 76 | 65 6c 6f 70 65 72 20 54 |tosh Dev|eloper T|
|000000f0| 65 63 68 6e 69 63 61 6c | 20 53 75 70 70 6f 72 74 |echnical| Support|
|00000100| 0d 23 0d 23 09 4d 75 6c | 74 69 46 69 6e 64 65 72 |.#.#.Mul|tiFinder|
|00000110| 2d 41 77 61 72 65 20 53 | 69 6d 70 6c 65 20 53 61 |-Aware S|imple Sa|
|00000120| 6d 70 6c 65 20 41 70 70 | 6c 69 63 61 74 69 6f 6e |mple App|lication|
|00000130| 0d 23 0d 23 09 53 61 6d | 70 6c 65 0d 23 0d 23 09 |.#.#.Sam|ple.#.#.|
|00000140| 53 61 6d 70 6c 65 2e 63 | 09 2d 09 43 20 53 6f 75 |Sample.c|.-.C Sou|
|00000150| 72 63 65 0d 23 0d 23 09 | 43 6f 70 79 72 69 67 68 |rce.#.#.|Copyrigh|
|00000160| 74 20 a9 20 31 39 38 39 | 20 41 70 70 6c 65 20 43 |t . 1989| Apple C|
|00000170| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 0d 23 09 |omputer,| Inc..#.|
|00000180| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|00000190| 76 65 64 2e 0d 23 0d 23 | 09 56 65 72 73 69 6f 6e |ved..#.#|.Version|
|000001a0| 73 3a 09 0d 23 09 09 09 | 09 31 2e 30 30 09 09 09 |s:..#...|.1.00...|
|000001b0| 09 30 38 2f 38 38 0d 23 | 09 09 09 09 31 2e 30 31 |.08/88.#|....1.01|
|000001c0| 09 09 09 09 31 31 2f 38 | 38 0d 23 09 09 09 09 31 |....11/8|8.#....1|
|000001d0| 2e 30 32 09 09 09 09 30 | 34 2f 38 39 0d 23 0d 23 |.02....0|4/89.#.#|
|000001e0| 09 43 6f 6d 70 6f 6e 65 | 6e 74 73 3a 0d 23 09 09 |.Compone|nts:.#..|
|000001f0| 09 09 53 61 6d 70 6c 65 | 2e 70 09 09 09 41 70 72 |..Sample|.p...Apr|
|00000200| 69 6c 20 31 2c 20 31 39 | 38 39 0d 23 09 09 09 09 |il 1, 19|89.#....|
|00000210| 53 61 6d 70 6c 65 2e 63 | 09 09 09 41 70 72 69 6c |Sample.c|...April|
|00000220| 20 31 2c 20 31 39 38 39 | 0d 23 09 09 09 09 53 61 | 1, 1989|.#....Sa|
|00000230| 6d 70 6c 65 2e 61 09 09 | 09 41 70 72 69 6c 20 31 |mple.a..|.April 1|
|00000240| 2c 20 31 39 38 39 0d 23 | 09 09 09 09 53 61 6d 70 |, 1989.#|....Samp|
|00000250| 6c 65 2e 69 6e 63 31 2e | 61 09 09 41 70 72 69 6c |le.inc1.|a..April|
|00000260| 20 31 2c 20 31 39 38 39 | 0d 23 09 09 09 09 53 61 | 1, 1989|.#....Sa|
|00000270| 6d 70 6c 65 4d 69 73 63 | 2e 61 09 09 41 70 72 69 |mpleMisc|.a..Apri|
|00000280| 6c 20 31 2c 20 31 39 38 | 39 0d 23 09 09 09 09 53 |l 1, 198|9.#....S|
|00000290| 61 6d 70 6c 65 2e 72 09 | 09 09 41 70 72 69 6c 20 |ample.r.|..April |
|000002a0| 31 2c 20 31 39 38 39 0d | 23 09 09 09 09 53 61 6d |1, 1989.|#....Sam|
|000002b0| 70 6c 65 2e 68 09 09 09 | 41 70 72 69 6c 20 31 2c |ple.h...|April 1,|
|000002c0| 20 31 39 38 39 0d 23 09 | 09 09 09 50 53 61 6d 70 | 1989.#.|...PSamp|
|000002d0| 6c 65 2e 6d 61 6b 65 09 | 09 41 70 72 69 6c 20 31 |le.make.|.April 1|
|000002e0| 2c 20 31 39 38 39 0d 23 | 09 09 09 09 43 53 61 6d |, 1989.#|....CSam|
|000002f0| 70 6c 65 2e 6d 61 6b 65 | 09 09 41 70 72 69 6c 20 |ple.make|..April |
|00000300| 31 2c 20 31 39 38 39 0d | 23 09 09 09 09 41 53 61 |1, 1989.|#....ASa|
|00000310| 6d 70 6c 65 2e 6d 61 6b | 65 09 09 41 70 72 69 6c |mple.mak|e..April|
|00000320| 20 31 2c 20 31 39 38 39 | 0d 23 0d 23 09 53 61 6d | 1, 1989|.#.#.Sam|
|00000330| 70 6c 65 20 69 73 20 61 | 6e 20 65 78 61 6d 70 6c |ple is a|n exampl|
|00000340| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 74 68 |e applic|ation th|
|00000350| 61 74 20 64 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |at demon|strates |
|00000360| 68 6f 77 20 74 6f 0d 23 | 09 69 6e 69 74 69 61 6c |how to.#|.initial|
|00000370| 69 7a 65 20 74 68 65 20 | 63 6f 6d 6d 6f 6e 6c 79 |ize the |commonly|
|00000380| 20 75 73 65 64 20 74 6f | 6f 6c 62 6f 78 20 6d 61 | used to|olbox ma|
|00000390| 6e 61 67 65 72 73 2c 20 | 6f 70 65 72 61 74 65 20 |nagers, |operate |
|000003a0| 0d 23 09 73 75 63 63 65 | 73 73 66 75 6c 6c 79 20 |.#.succe|ssfully |
|000003b0| 75 6e 64 65 72 20 4d 75 | 6c 74 69 46 69 6e 64 65 |under Mu|ltiFinde|
|000003c0| 72 2c 20 68 61 6e 64 6c | 65 20 64 65 73 6b 20 61 |r, handl|e desk a|
|000003d0| 63 63 65 73 73 6f 72 69 | 65 73 2c 20 0d 23 09 61 |ccessori|es, .#.a|
|000003e0| 6e 64 20 63 72 65 61 74 | 65 2c 20 67 72 6f 77 2c |nd creat|e, grow,|
|000003f0| 20 61 6e 64 20 7a 6f 6f | 6d 20 77 69 6e 64 6f 77 | and zoo|m window|
|00000400| 73 2e 0d 23 0d 23 09 49 | 74 20 64 6f 65 73 20 6e |s..#.#.I|t does n|
|00000410| 6f 74 20 62 79 20 61 6e | 79 20 6d 65 61 6e 73 20 |ot by an|y means |
|00000420| 64 65 6d 6f 6e 73 74 72 | 61 74 65 20 61 6c 6c 20 |demonstr|ate all |
|00000430| 74 68 65 20 74 65 63 68 | 6e 69 71 75 65 73 20 0d |the tech|niques .|
|00000440| 23 09 79 6f 75 20 6e 65 | 65 64 20 66 6f 72 20 61 |#.you ne|ed for a|
|00000450| 20 6c 61 72 67 65 20 61 | 70 70 6c 69 63 61 74 69 | large a|pplicati|
|00000460| 6f 6e 2e 20 49 6e 20 70 | 61 72 74 69 63 75 6c 61 |on. In p|articula|
|00000470| 72 2c 20 53 61 6d 70 6c | 65 20 0d 23 09 64 6f 65 |r, Sampl|e .#.doe|
|00000480| 73 20 6e 6f 74 20 63 6f | 76 65 72 20 65 78 63 65 |s not co|ver exce|
|00000490| 70 74 69 6f 6e 20 68 61 | 6e 64 6c 69 6e 67 2c 20 |ption ha|ndling, |
|000004a0| 6d 75 6c 74 69 70 6c 65 | 20 77 69 6e 64 6f 77 73 |multiple| windows|
|000004b0| 2f 64 6f 63 75 6d 65 6e | 74 73 2c 20 0d 23 09 73 |/documen|ts, .#.s|
|000004c0| 6f 70 68 69 73 74 69 63 | 61 74 65 64 20 6d 65 6d |ophistic|ated mem|
|000004d0| 6f 72 79 20 6d 61 6e 61 | 67 65 6d 65 6e 74 2c 20 |ory mana|gement, |
|000004e0| 70 72 69 6e 74 69 6e 67 | 2c 20 6f 72 20 75 6e 64 |printing|, or und|
|000004f0| 6f 2e 20 41 6c 6c 20 6f | 66 20 0d 23 09 74 68 65 |o. All o|f .#.the|
|00000500| 73 65 20 61 72 65 20 76 | 69 74 61 6c 20 70 61 72 |se are v|ital par|
|00000510| 74 73 20 6f 66 20 61 20 | 6e 6f 72 6d 61 6c 20 66 |ts of a |normal f|
|00000520| 75 6c 6c 2d 73 69 7a 65 | 64 20 61 70 70 6c 69 63 |ull-size|d applic|
|00000530| 61 74 69 6f 6e 2e 0d 23 | 0d 23 09 54 68 69 73 20 |ation..#|.#.This |
|00000540| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 73 20 61 |applicat|ion is a|
|00000550| 6e 20 65 78 61 6d 70 6c | 65 20 6f 66 20 74 68 65 |n exampl|e of the|
|00000560| 20 66 6f 72 6d 20 6f 66 | 20 61 20 4d 61 63 69 6e | form of| a Macin|
|00000570| 74 6f 73 68 20 0d 23 09 | 61 70 70 6c 69 63 61 74 |tosh .#.|applicat|
|00000580| 69 6f 6e 3b 20 69 74 20 | 69 73 20 4e 4f 54 20 61 |ion; it |is NOT a|
|00000590| 20 74 65 6d 70 6c 61 74 | 65 2e 20 49 74 20 69 73 | templat|e. It is|
|000005a0| 20 4e 4f 54 20 69 6e 74 | 65 6e 64 65 64 20 74 6f | NOT int|ended to|
|000005b0| 20 62 65 20 0d 23 09 75 | 73 65 64 20 61 73 20 61 | be .#.u|sed as a|
|000005c0| 20 66 6f 75 6e 64 61 74 | 69 6f 6e 20 66 6f 72 20 | foundat|ion for |
|000005d0| 74 68 65 20 6e 65 78 74 | 20 77 6f 72 6c 64 2d 63 |the next| world-c|
|000005e0| 6c 61 73 73 2c 20 62 65 | 73 74 2d 73 65 6c 6c 69 |lass, be|st-selli|
|000005f0| 6e 67 2c 20 0d 23 09 36 | 30 30 4b 20 61 70 70 6c |ng, .#.6|00K appl|
|00000600| 69 63 61 74 69 6f 6e 2e | 20 41 20 73 74 69 63 6b |ication.| A stick|
|00000610| 20 66 69 67 75 72 65 20 | 64 72 61 77 69 6e 67 20 | figure |drawing |
|00000620| 6f 66 20 74 68 65 20 68 | 75 6d 61 6e 20 62 6f 64 |of the h|uman bod|
|00000630| 79 20 6d 61 79 20 0d 23 | 09 62 65 20 61 20 67 6f |y may .#|.be a go|
|00000640| 6f 64 20 65 78 61 6d 70 | 6c 65 20 6f 66 20 74 68 |od examp|le of th|
|00000650| 65 20 66 6f 72 6d 20 66 | 6f 72 20 61 20 70 61 69 |e form f|or a pai|
|00000660| 6e 74 69 6e 67 2c 20 62 | 75 74 20 74 68 61 74 20 |nting, b|ut that |
|00000670| 64 6f 65 73 20 6e 6f 74 | 20 0d 23 09 6d 65 61 6e |does not| .#.mean|
|00000680| 20 69 74 20 73 68 6f 75 | 6c 64 20 62 65 20 75 73 | it shou|ld be us|
|00000690| 65 64 20 61 73 20 74 68 | 65 20 62 61 73 69 73 20 |ed as th|e basis |
|000006a0| 66 6f 72 20 74 68 65 20 | 6e 65 78 74 20 4d 6f 6e |for the |next Mon|
|000006b0| 61 20 4c 69 73 61 2e 0d | 23 0d 23 09 57 65 20 72 |a Lisa..|#.#.We r|
|000006c0| 65 63 6f 6d 6d 65 6e 64 | 20 74 68 61 74 20 79 6f |ecommend| that yo|
|000006d0| 75 20 72 65 76 69 65 77 | 20 74 68 69 73 20 70 72 |u review| this pr|
|000006e0| 6f 67 72 61 6d 20 6f 72 | 20 54 45 53 61 6d 70 6c |ogram or| TESampl|
|000006f0| 65 20 62 65 66 6f 72 65 | 20 0d 23 09 62 65 67 69 |e before| .#.begi|
|00000700| 6e 6e 69 6e 67 20 61 20 | 6e 65 77 20 61 70 70 6c |nning a |new appl|
|00000710| 69 63 61 74 69 6f 6e 2e | 0d 23 0d 2d 2d 2d 2d 2d |ication.|.#.-----|
|00000720| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000730| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000740| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000750| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000760| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2a 2f 0d 0d 0d 2f 2a |--------|-*/.../*|
|00000770| 20 53 65 67 6d 65 6e 74 | 61 74 69 6f 6e 20 73 74 | Segment|ation st|
|00000780| 72 61 74 65 67 79 3a 0d | 0d 20 20 20 54 68 69 73 |rategy:.|. This|
|00000790| 20 70 72 6f 67 72 61 6d | 20 63 6f 6e 73 69 73 74 | program| consist|
|000007a0| 73 20 6f 66 20 74 68 72 | 65 65 20 73 65 67 6d 65 |s of thr|ee segme|
|000007b0| 6e 74 73 2e 20 4d 61 69 | 6e 20 63 6f 6e 74 61 69 |nts. Mai|n contai|
|000007c0| 6e 73 20 6d 6f 73 74 20 | 6f 66 20 74 68 65 20 63 |ns most |of the c|
|000007d0| 6f 64 65 2c 0d 20 20 20 | 69 6e 63 6c 75 64 69 6e |ode,. |includin|
|000007e0| 67 20 74 68 65 20 4d 50 | 57 20 6c 69 62 72 61 72 |g the MP|W librar|
|000007f0| 69 65 73 2c 20 61 6e 64 | 20 74 68 65 20 6d 61 69 |ies, and| the mai|
|00000800| 6e 20 70 72 6f 67 72 61 | 6d 2e 20 49 6e 69 74 69 |n progra|m. Initi|
|00000810| 61 6c 69 7a 65 20 63 6f | 6e 74 61 69 6e 73 0d 20 |alize co|ntains. |
|00000820| 20 20 63 6f 64 65 20 74 | 68 61 74 20 69 73 20 6f | code t|hat is o|
|00000830| 6e 6c 79 20 75 73 65 64 | 20 6f 6e 63 65 2c 20 64 |nly used| once, d|
|00000840| 75 72 69 6e 67 20 73 74 | 61 72 74 75 70 2c 20 61 |uring st|artup, a|
|00000850| 6e 64 20 63 61 6e 20 62 | 65 20 75 6e 6c 6f 61 64 |nd can b|e unload|
|00000860| 65 64 20 61 66 74 65 72 | 20 74 68 65 0d 20 20 20 |ed after| the. |
|00000870| 70 72 6f 67 72 61 6d 20 | 73 74 61 72 74 73 2e 20 |program |starts. |
|00000880| 25 41 35 49 6e 69 74 20 | 69 73 20 61 75 74 6f 6d |%A5Init |is autom|
|00000890| 61 74 69 63 61 6c 6c 79 | 20 63 72 65 61 74 65 64 |atically| created|
|000008a0| 20 62 79 20 74 68 65 20 | 4c 69 6e 6b 65 72 20 74 | by the |Linker t|
|000008b0| 6f 20 69 6e 69 74 69 61 | 6c 69 7a 65 0d 20 20 20 |o initia|lize. |
|000008c0| 67 6c 6f 62 61 6c 73 20 | 66 6f 72 20 74 68 65 20 |globals |for the |
|000008d0| 4d 50 57 20 6c 69 62 72 | 61 72 69 65 73 20 61 6e |MPW libr|aries an|
|000008e0| 64 20 69 73 20 75 6e 6c | 6f 61 64 65 64 20 72 69 |d is unl|oaded ri|
|000008f0| 67 68 74 20 61 77 61 79 | 2e 20 2a 2f 0d 0d 0d 2f |ght away|. */.../|
|00000900| 2a 20 53 65 74 50 6f 72 | 74 20 73 74 72 61 74 65 |* SetPor|t strate|
|00000910| 67 79 3a 0d 0d 20 20 20 | 54 6f 6f 6c 62 6f 78 20 |gy:.. |Toolbox |
|00000920| 72 6f 75 74 69 6e 65 73 | 20 64 6f 20 6e 6f 74 20 |routines| do not |
|00000930| 63 68 61 6e 67 65 20 74 | 68 65 20 63 75 72 72 65 |change t|he curre|
|00000940| 6e 74 20 70 6f 72 74 2e | 20 49 6e 20 73 70 69 74 |nt port.| In spit|
|00000950| 65 20 6f 66 20 74 68 69 | 73 2c 20 69 6e 20 74 68 |e of thi|s, in th|
|00000960| 69 73 0d 20 20 20 70 72 | 6f 67 72 61 6d 20 77 65 |is. pr|ogram we|
|00000970| 20 75 73 65 20 61 20 73 | 74 72 61 74 65 67 79 20 | use a s|trategy |
|00000980| 6f 66 20 63 61 6c 6c 69 | 6e 67 20 53 65 74 50 6f |of calli|ng SetPo|
|00000990| 72 74 20 77 68 65 6e 65 | 76 65 72 20 77 65 20 77 |rt whene|ver we w|
|000009a0| 61 6e 74 20 74 6f 20 64 | 72 61 77 20 6f 72 0d 20 |ant to d|raw or. |
|000009b0| 20 20 6d 61 6b 65 20 63 | 61 6c 6c 73 20 77 68 69 | make c|alls whi|
|000009c0| 63 68 20 64 65 70 65 6e | 64 20 6f 6e 20 74 68 65 |ch depen|d on the|
|000009d0| 20 63 75 72 72 65 6e 74 | 20 70 6f 72 74 2e 20 54 | current| port. T|
|000009e0| 68 69 73 20 6d 61 6b 65 | 73 20 75 73 20 6c 65 73 |his make|s us les|
|000009f0| 73 20 76 75 6c 6e 65 72 | 61 62 6c 65 0d 20 20 20 |s vulner|able. |
|00000a00| 74 6f 20 62 75 67 73 20 | 69 6e 20 6f 74 68 65 72 |to bugs |in other|
|00000a10| 20 73 6f 66 74 77 61 72 | 65 20 77 68 69 63 68 20 | softwar|e which |
|00000a20| 6d 69 67 68 74 20 61 6c | 74 65 72 20 74 68 65 20 |might al|ter the |
|00000a30| 63 75 72 72 65 6e 74 20 | 70 6f 72 74 20 28 73 75 |current |port (su|
|00000a40| 63 68 20 61 73 20 74 68 | 65 0d 20 20 20 62 75 67 |ch as th|e. bug|
|00000a50| 20 28 66 65 61 74 75 72 | 65 3f 29 20 69 6e 20 6d | (featur|e?) in m|
|00000a60| 61 6e 79 20 64 65 73 6b | 20 61 63 63 65 73 73 6f |any desk| accesso|
|00000a70| 72 69 65 73 20 77 68 69 | 63 68 20 63 68 61 6e 67 |ries whi|ch chang|
|00000a80| 65 20 74 68 65 20 70 6f | 72 74 20 6f 6e 20 4f 70 |e the po|rt on Op|
|00000a90| 65 6e 44 65 73 6b 41 63 | 63 29 2e 0d 20 20 20 48 |enDeskAc|c).. H|
|00000aa0| 6f 70 65 66 75 6c 6c 79 | 2c 20 74 68 69 73 20 61 |opefully|, this a|
|00000ab0| 6c 73 6f 20 6d 61 6b 65 | 73 20 74 68 65 20 72 6f |lso make|s the ro|
|00000ac0| 75 74 69 6e 65 73 20 66 | 72 6f 6d 20 74 68 69 73 |utines f|rom this|
|00000ad0| 20 70 72 6f 67 72 61 6d | 20 6d 6f 72 65 20 73 65 | program| more se|
|00000ae0| 6c 66 2d 63 6f 6e 74 61 | 69 6e 65 64 2c 0d 20 20 |lf-conta|ined,. |
|00000af0| 20 73 69 6e 63 65 20 74 | 68 65 79 20 64 6f 6e 27 | since t|hey don'|
|00000b00| 74 20 64 65 70 65 6e 64 | 20 6f 6e 20 74 68 65 20 |t depend| on the |
|00000b10| 63 75 72 72 65 6e 74 20 | 70 6f 72 74 20 73 65 74 |current |port set|
|00000b20| 74 69 6e 67 2e 20 2a 2f | 0d 0d 0d 23 69 6e 63 6c |ting. */|...#incl|
|00000b30| 75 64 65 20 3c 56 61 6c | 75 65 73 2e 68 3e 0d 23 |ude <Val|ues.h>.#|
|00000b40| 69 6e 63 6c 75 64 65 20 | 3c 54 79 70 65 73 2e 68 |include |<Types.h|
|00000b50| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 52 65 73 6f |>.#inclu|de <Reso|
|00000b60| 75 72 63 65 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |urces.h>|.#includ|
|00000b70| 65 20 3c 51 75 69 63 6b | 44 72 61 77 2e 68 3e 0d |e <Quick|Draw.h>.|
|00000b80| 23 69 6e 63 6c 75 64 65 | 20 3c 46 6f 6e 74 73 2e |#include| <Fonts.|
|00000b90| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 45 76 65 |h>.#incl|ude <Eve|
|00000ba0| 6e 74 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |nts.h>.#|include |
|00000bb0| 3c 57 69 6e 64 6f 77 73 | 2e 68 3e 0d 23 69 6e 63 |<Windows|.h>.#inc|
|00000bc0| 6c 75 64 65 20 3c 4d 65 | 6e 75 73 2e 68 3e 0d 23 |lude <Me|nus.h>.#|
|00000bd0| 69 6e 63 6c 75 64 65 20 | 3c 54 65 78 74 45 64 69 |include |<TextEdi|
|00000be0| 74 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 44 |t.h>.#in|clude <D|
|00000bf0| 69 61 6c 6f 67 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ialogs.h|>.#inclu|
|00000c00| 64 65 20 3c 44 65 73 6b | 2e 68 3e 0d 23 69 6e 63 |de <Desk|.h>.#inc|
|00000c10| 6c 75 64 65 20 3c 54 6f | 6f 6c 55 74 69 6c 73 2e |lude <To|olUtils.|
|00000c20| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 4d 65 6d |h>.#incl|ude <Mem|
|00000c30| 6f 72 79 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ory.h>.#|include |
|00000c40| 3c 53 65 67 4c 6f 61 64 | 2e 68 3e 0d 23 69 6e 63 |<SegLoad|.h>.#inc|
|00000c50| 6c 75 64 65 20 3c 46 69 | 6c 65 73 2e 68 3e 0d 23 |lude <Fi|les.h>.#|
|00000c60| 69 6e 63 6c 75 64 65 20 | 3c 4f 53 55 74 69 6c 73 |include |<OSUtils|
|00000c70| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 4f 53 |.h>.#inc|lude <OS|
|00000c80| 45 76 65 6e 74 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |Events.h|>.#inclu|
|00000c90| 64 65 20 3c 44 69 73 6b | 49 6e 69 74 2e 68 3e 0d |de <Disk|Init.h>.|
|00000ca0| 23 69 6e 63 6c 75 64 65 | 20 3c 50 61 63 6b 61 67 |#include| <Packag|
|00000cb0| 65 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |es.h>.#i|nclude <|
|00000cc0| 54 72 61 70 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |Traps.h>|.#includ|
|00000cd0| 65 20 3c 53 61 6d 70 6c | 65 2e 68 3e 09 09 2f 2a |e <Sampl|e.h>../*|
|00000ce0| 20 62 72 69 6e 67 20 69 | 6e 20 61 6c 6c 20 74 68 | bring i|n all th|
|00000cf0| 65 20 23 64 65 66 69 6e | 65 73 20 66 6f 72 20 53 |e #defin|es for S|
|00000d00| 61 6d 70 6c 65 20 2a 2f | 0d 0d 0d 2f 2a 20 54 68 |ample */|.../* Th|
|00000d10| 65 20 22 67 22 20 70 72 | 65 66 69 78 20 69 73 20 |e "g" pr|efix is |
|00000d20| 75 73 65 64 20 74 6f 20 | 65 6d 70 68 61 73 69 7a |used to |emphasiz|
|00000d30| 65 20 74 68 61 74 20 61 | 20 76 61 72 69 61 62 6c |e that a| variabl|
|00000d40| 65 20 69 73 20 67 6c 6f | 62 61 6c 2e 20 2a 2f 0d |e is glo|bal. */.|
|00000d50| 0d 2f 2a 20 47 4d 61 63 | 20 69 73 20 75 73 65 64 |./* GMac| is used|
|00000d60| 20 74 6f 20 68 6f 6c 64 | 20 74 68 65 20 72 65 73 | to hold| the res|
|00000d70| 75 6c 74 20 6f 66 20 61 | 20 53 79 73 45 6e 76 69 |ult of a| SysEnvi|
|00000d80| 72 6f 6e 73 20 63 61 6c | 6c 2e 20 54 68 69 73 20 |rons cal|l. This |
|00000d90| 6d 61 6b 65 73 0d 20 20 | 20 69 74 20 63 6f 6e 76 |makes. | it conv|
|00000da0| 65 6e 69 65 6e 74 20 66 | 6f 72 20 61 6e 79 20 72 |enient f|or any r|
|00000db0| 6f 75 74 69 6e 65 20 74 | 6f 20 63 68 65 63 6b 20 |outine t|o check |
|00000dc0| 74 68 65 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2e |the envi|ronment.|
|00000dd0| 20 2a 2f 0d 53 79 73 45 | 6e 76 52 65 63 09 67 4d | */.SysE|nvRec.gM|
|00000de0| 61 63 3b 09 09 09 09 2f | 2a 20 73 65 74 20 75 70 |ac;..../|* set up|
|00000df0| 20 62 79 20 49 6e 69 74 | 69 61 6c 69 7a 65 20 2a | by Init|ialize *|
|00000e00| 2f 0d 0d 2f 2a 20 47 48 | 61 73 57 61 69 74 4e 65 |/../* GH|asWaitNe|
|00000e10| 78 74 45 76 65 6e 74 20 | 69 73 20 73 65 74 20 61 |xtEvent |is set a|
|00000e20| 74 20 73 74 61 72 74 75 | 70 2c 20 61 6e 64 20 74 |t startu|p, and t|
|00000e30| 65 6c 6c 73 20 77 68 65 | 74 68 65 72 20 74 68 65 |ells whe|ther the|
|00000e40| 20 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 0d 20 | WaitNex|tEvent. |
|00000e50| 20 20 74 72 61 70 20 69 | 73 20 61 76 61 69 6c 61 | trap i|s availa|
|00000e60| 62 6c 65 2e 20 49 66 20 | 69 74 20 69 73 20 66 61 |ble. If |it is fa|
|00000e70| 6c 73 65 2c 20 77 65 20 | 6b 6e 6f 77 20 74 68 61 |lse, we |know tha|
|00000e80| 74 20 77 65 20 6d 75 73 | 74 20 63 61 6c 6c 20 47 |t we mus|t call G|
|00000e90| 65 74 4e 65 78 74 45 76 | 65 6e 74 2e 20 2a 2f 0d |etNextEv|ent. */.|
|00000ea0| 42 6f 6f 6c 65 61 6e 09 | 09 67 48 61 73 57 61 69 |Boolean.|.gHasWai|
|00000eb0| 74 4e 65 78 74 45 76 65 | 6e 74 3b 09 2f 2a 20 73 |tNextEve|nt;./* s|
|00000ec0| 65 74 20 75 70 20 62 79 | 20 49 6e 69 74 69 61 6c |et up by| Initial|
|00000ed0| 69 7a 65 20 2a 2f 0d 0d | 2f 2a 20 47 49 6e 42 61 |ize */..|/* GInBa|
|00000ee0| 63 6b 67 72 6f 75 6e 64 | 20 69 73 20 6d 61 69 6e |ckground| is main|
|00000ef0| 74 61 69 6e 65 64 20 62 | 79 20 6f 75 72 20 6f 73 |tained b|y our os|
|00000f00| 45 76 65 6e 74 20 68 61 | 6e 64 6c 69 6e 67 20 72 |Event ha|ndling r|
|00000f10| 6f 75 74 69 6e 65 73 2e | 20 41 6e 79 20 70 61 72 |outines.| Any par|
|00000f20| 74 20 6f 66 0d 20 20 20 | 74 68 65 20 70 72 6f 67 |t of. |the prog|
|00000f30| 72 61 6d 20 63 61 6e 20 | 63 68 65 63 6b 20 69 74 |ram can |check it|
|00000f40| 20 74 6f 20 66 69 6e 64 | 20 6f 75 74 20 69 66 20 | to find| out if |
|00000f50| 69 74 20 69 73 20 63 75 | 72 72 65 6e 74 6c 79 20 |it is cu|rrently |
|00000f60| 69 6e 20 74 68 65 20 62 | 61 63 6b 67 72 6f 75 6e |in the b|ackgroun|
|00000f70| 64 2e 20 2a 2f 0d 42 6f | 6f 6c 65 61 6e 09 09 67 |d. */.Bo|olean..g|
|00000f80| 49 6e 42 61 63 6b 67 72 | 6f 75 6e 64 3b 09 09 2f |InBackgr|ound;../|
|00000f90| 2a 20 6d 61 69 6e 74 61 | 69 6e 65 64 20 62 79 20 |* mainta|ined by |
|00000fa0| 49 6e 69 74 69 61 6c 69 | 7a 65 20 61 6e 64 20 44 |Initiali|ze and D|
|00000fb0| 6f 45 76 65 6e 74 20 2a | 2f 0d 0d 0d 2f 2a 20 54 |oEvent *|/.../* T|
|00000fc0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 67 6c 6f |he follo|wing glo|
|00000fd0| 62 61 6c 73 20 61 72 65 | 20 74 68 65 20 73 74 61 |bals are| the sta|
|00000fe0| 74 65 20 6f 66 20 74 68 | 65 20 77 69 6e 64 6f 77 |te of th|e window|
|00000ff0| 2e 20 49 66 20 77 65 20 | 73 75 70 70 6f 72 74 65 |. If we |supporte|
|00001000| 64 20 6d 6f 72 65 20 74 | 68 61 6e 0d 20 20 20 6f |d more t|han. o|
|00001010| 6e 65 20 77 69 6e 64 6f | 77 2c 20 74 68 65 79 20 |ne windo|w, they |
|00001020| 77 6f 75 6c 64 20 62 65 | 20 61 74 74 61 74 63 68 |would be| attatch|
|00001030| 65 64 20 74 6f 20 65 61 | 63 68 20 64 6f 63 75 6d |ed to ea|ch docum|
|00001040| 65 6e 74 2c 20 72 61 74 | 68 65 72 20 74 68 61 6e |ent, rat|her than|
|00001050| 20 67 6c 6f 62 61 6c 73 | 2e 20 2a 2f 0d 0d 2f 2a | globals|. */../*|
|00001060| 20 47 53 74 6f 70 70 65 | 64 20 74 65 6c 6c 73 20 | GStoppe|d tells |
|00001070| 77 68 65 74 68 65 72 20 | 74 68 65 20 73 74 6f 70 |whether |the stop|
|00001080| 20 6c 69 67 68 74 20 69 | 73 20 63 75 72 72 65 6e | light i|s curren|
|00001090| 74 6c 79 20 6f 6e 20 73 | 74 6f 70 20 6f 72 20 67 |tly on s|top or g|
|000010a0| 6f 2e 20 2a 2f 0d 42 6f | 6f 6c 65 61 6e 09 09 67 |o. */.Bo|olean..g|
|000010b0| 53 74 6f 70 70 65 64 3b | 09 09 09 2f 2a 20 6d 61 |Stopped;|.../* ma|
|000010c0| 69 6e 74 61 69 6e 65 64 | 20 62 79 20 49 6e 69 74 |intained| by Init|
|000010d0| 69 61 6c 69 7a 65 20 61 | 6e 64 20 53 65 74 4c 69 |ialize a|nd SetLi|
|000010e0| 67 68 74 20 2a 2f 0d 0d | 2f 2a 20 47 53 74 6f 70 |ght */..|/* GStop|
|000010f0| 52 65 63 74 20 61 6e 64 | 20 67 47 6f 52 65 63 74 |Rect and| gGoRect|
|00001100| 20 61 72 65 20 74 68 65 | 20 72 65 63 74 61 6e 67 | are the| rectang|
|00001110| 6c 65 73 20 6f 66 20 74 | 68 65 20 74 77 6f 20 73 |les of t|he two s|
|00001120| 74 6f 70 20 6c 69 67 68 | 74 73 20 69 6e 20 74 68 |top ligh|ts in th|
|00001130| 65 20 77 69 6e 64 6f 77 | 2e 20 2a 2f 0d 52 65 63 |e window|. */.Rec|
|00001140| 74 09 09 67 53 74 6f 70 | 52 65 63 74 3b 09 09 09 |t..gStop|Rect;...|
|00001150| 2f 2a 20 73 65 74 20 75 | 70 20 62 79 20 49 6e 69 |/* set u|p by Ini|
|00001160| 74 69 61 6c 69 7a 65 20 | 2a 2f 0d 52 65 63 74 09 |tialize |*/.Rect.|
|00001170| 09 67 47 6f 52 65 63 74 | 3b 09 09 09 2f 2a 20 73 |.gGoRect|;.../* s|
|00001180| 65 74 20 75 70 20 62 79 | 20 49 6e 69 74 69 61 6c |et up by| Initial|
|00001190| 69 7a 65 20 2a 2f 0d 0d | 0d 2f 2a 20 48 65 72 65 |ize */..|./* Here|
|000011a0| 20 61 72 65 20 64 65 63 | 6c 61 72 61 74 69 6f 6e | are dec|laration|
|000011b0| 73 20 66 6f 72 20 61 6c | 6c 20 6f 66 20 74 68 65 |s for al|l of the|
|000011c0| 20 43 20 72 6f 75 74 69 | 6e 65 73 2e 20 49 6e 20 | C routi|nes. In |
|000011d0| 4d 50 57 20 33 2e 30 20 | 77 65 20 63 61 6e 20 75 |MPW 3.0 |we can u|
|000011e0| 73 65 0d 20 20 20 61 63 | 74 75 61 6c 20 70 72 6f |se. ac|tual pro|
|000011f0| 74 6f 74 79 70 65 73 20 | 66 6f 72 20 70 61 72 61 |totypes |for para|
|00001200| 6d 65 74 65 72 20 74 79 | 70 65 20 63 68 65 63 6b |meter ty|pe check|
|00001210| 69 6e 67 2e 20 2a 2f 0d | 76 6f 69 64 20 45 76 65 |ing. */.|void Eve|
|00001220| 6e 74 4c 6f 6f 70 28 20 | 76 6f 69 64 20 29 3b 0d |ntLoop( |void );.|
|00001230| 76 6f 69 64 20 44 6f 45 | 76 65 6e 74 28 20 45 76 |void DoE|vent( Ev|
|00001240| 65 6e 74 52 65 63 6f 72 | 64 20 2a 65 76 65 6e 74 |entRecor|d *event|
|00001250| 20 29 3b 0d 76 6f 69 64 | 20 41 64 6a 75 73 74 43 | );.void| AdjustC|
|00001260| 75 72 73 6f 72 28 20 50 | 6f 69 6e 74 20 6d 6f 75 |ursor( P|oint mou|
|00001270| 73 65 2c 20 52 67 6e 48 | 61 6e 64 6c 65 20 72 65 |se, RgnH|andle re|
|00001280| 67 69 6f 6e 20 29 3b 0d | 76 6f 69 64 20 47 65 74 |gion );.|void Get|
|00001290| 47 6c 6f 62 61 6c 4d 6f | 75 73 65 28 20 50 6f 69 |GlobalMo|use( Poi|
|000012a0| 6e 74 20 2a 6d 6f 75 73 | 65 20 29 3b 0d 76 6f 69 |nt *mous|e );.voi|
|000012b0| 64 20 44 6f 55 70 64 61 | 74 65 28 20 57 69 6e 64 |d DoUpda|te( Wind|
|000012c0| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 20 29 3b 0d |owPtr wi|ndow );.|
|000012d0| 76 6f 69 64 20 44 6f 41 | 63 74 69 76 61 74 65 28 |void DoA|ctivate(|
|000012e0| 20 57 69 6e 64 6f 77 50 | 74 72 20 77 69 6e 64 6f | WindowP|tr windo|
|000012f0| 77 2c 20 42 6f 6f 6c 65 | 61 6e 20 62 65 63 6f 6d |w, Boole|an becom|
|00001300| 69 6e 67 41 63 74 69 76 | 65 20 29 3b 0d 76 6f 69 |ingActiv|e );.voi|
|00001310| 64 20 44 6f 43 6f 6e 74 | 65 6e 74 43 6c 69 63 6b |d DoCont|entClick|
|00001320| 28 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |( Window|Ptr wind|
|00001330| 6f 77 20 29 3b 0d 76 6f | 69 64 20 44 72 61 77 57 |ow );.vo|id DrawW|
|00001340| 69 6e 64 6f 77 28 20 57 | 69 6e 64 6f 77 50 74 72 |indow( W|indowPtr|
|00001350| 20 77 69 6e 64 6f 77 20 | 29 3b 0d 76 6f 69 64 20 | window |);.void |
|00001360| 41 64 6a 75 73 74 4d 65 | 6e 75 73 28 20 76 6f 69 |AdjustMe|nus( voi|
|00001370| 64 20 29 3b 0d 76 6f 69 | 64 20 44 6f 4d 65 6e 75 |d );.voi|d DoMenu|
|00001380| 43 6f 6d 6d 61 6e 64 28 | 20 6c 6f 6e 67 20 6d 65 |Command(| long me|
|00001390| 6e 75 52 65 73 75 6c 74 | 20 29 3b 0d 76 6f 69 64 |nuResult| );.void|
|000013a0| 20 53 65 74 4c 69 67 68 | 74 28 20 57 69 6e 64 6f | SetLigh|t( Windo|
|000013b0| 77 50 74 72 20 77 69 6e | 64 6f 77 2c 20 42 6f 6f |wPtr win|dow, Boo|
|000013c0| 6c 65 61 6e 20 6e 65 77 | 53 74 6f 70 70 65 64 20 |lean new|Stopped |
|000013d0| 29 3b 0d 42 6f 6f 6c 65 | 61 6e 20 44 6f 43 6c 6f |);.Boole|an DoClo|
|000013e0| 73 65 57 69 6e 64 6f 77 | 28 20 57 69 6e 64 6f 77 |seWindow|( Window|
|000013f0| 50 74 72 20 77 69 6e 64 | 6f 77 20 29 3b 0d 76 6f |Ptr wind|ow );.vo|
|00001400| 69 64 20 54 65 72 6d 69 | 6e 61 74 65 28 20 76 6f |id Termi|nate( vo|
|00001410| 69 64 20 29 3b 0d 76 6f | 69 64 20 49 6e 69 74 69 |id );.vo|id Initi|
|00001420| 61 6c 69 7a 65 28 57 69 | 6e 64 6f 77 50 74 72 20 |alize(Wi|ndowPtr |
|00001430| 2a 77 69 6e 29 3b 0d 42 | 6f 6f 6c 65 61 6e 20 47 |*win);.B|oolean G|
|00001440| 6f 47 65 74 52 65 63 74 | 28 20 73 68 6f 72 74 20 |oGetRect|( short |
|00001450| 72 65 63 74 49 44 2c 20 | 52 65 63 74 20 2a 74 68 |rectID, |Rect *th|
|00001460| 65 52 65 63 74 20 29 3b | 0d 76 6f 69 64 20 46 6f |eRect );|.void Fo|
|00001470| 72 63 65 45 6e 76 69 72 | 6f 6e 73 28 20 76 6f 69 |rceEnvir|ons( voi|
|00001480| 64 20 29 3b 0d 42 6f 6f | 6c 65 61 6e 20 49 73 41 |d );.Boo|lean IsA|
|00001490| 70 70 57 69 6e 64 6f 77 | 28 20 57 69 6e 64 6f 77 |ppWindow|( Window|
|000014a0| 50 74 72 20 77 69 6e 64 | 6f 77 20 29 3b 0d 42 6f |Ptr wind|ow );.Bo|
|000014b0| 6f 6c 65 61 6e 20 49 73 | 44 41 57 69 6e 64 6f 77 |olean Is|DAWindow|
|000014c0| 28 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |( Window|Ptr wind|
|000014d0| 6f 77 20 29 3b 0d 42 6f | 6f 6c 65 61 6e 20 54 72 |ow );.Bo|olean Tr|
|000014e0| 61 70 41 76 61 69 6c 61 | 62 6c 65 28 20 73 68 6f |apAvaila|ble( sho|
|000014f0| 72 74 20 74 4e 75 6d 62 | 65 72 2c 20 54 72 61 70 |rt tNumb|er, Trap|
|00001500| 54 79 70 65 20 74 54 79 | 70 65 20 29 3b 0d 76 6f |Type tTy|pe );.vo|
|00001510| 69 64 20 41 6c 65 72 74 | 55 73 65 72 28 20 76 6f |id Alert|User( vo|
|00001520| 69 64 20 29 3b 0d 0d 0d | 2f 2a 20 44 65 66 69 6e |id );...|/* Defin|
|00001530| 65 20 48 69 57 72 64 20 | 61 6e 64 20 4c 6f 57 72 |e HiWrd |and LoWr|
|00001540| 64 20 6d 61 63 72 6f 73 | 20 66 6f 72 20 65 66 66 |d macros| for eff|
|00001550| 69 63 69 65 6e 63 79 2e | 20 2a 2f 0d 23 64 65 66 |iciency.| */.#def|
|00001560| 69 6e 65 20 48 69 57 72 | 64 28 61 4c 6f 6e 67 29 |ine HiWr|d(aLong)|
|00001570| 09 28 28 28 61 4c 6f 6e | 67 29 20 3e 3e 20 31 36 |.(((aLon|g) >> 16|
|00001580| 29 20 26 20 30 78 46 46 | 46 46 29 0d 23 64 65 66 |) & 0xFF|FF).#def|
|00001590| 69 6e 65 20 4c 6f 57 72 | 64 28 61 4c 6f 6e 67 29 |ine LoWr|d(aLong)|
|000015a0| 09 28 28 61 4c 6f 6e 67 | 29 20 26 20 30 78 46 46 |.((aLong|) & 0xFF|
|000015b0| 46 46 29 0d 0d 2f 2a 20 | 44 65 66 69 6e 65 20 54 |FF)../* |Define T|
|000015c0| 6f 70 4c 65 66 74 20 61 | 6e 64 20 42 6f 74 52 69 |opLeft a|nd BotRi|
|000015d0| 67 68 74 20 6d 61 63 72 | 6f 73 20 66 6f 72 20 63 |ght macr|os for c|
|000015e0| 6f 6e 76 65 6e 69 65 6e | 63 65 2e 20 4e 6f 74 69 |onvenien|ce. Noti|
|000015f0| 63 65 20 74 68 65 20 69 | 6d 70 6c 69 63 69 74 0d |ce the i|mplicit.|
|00001600| 20 20 20 64 65 70 65 6e | 64 65 6e 63 79 20 6f 6e | depen|dency on|
|00001610| 20 74 68 65 20 6f 72 64 | 65 72 69 6e 67 20 6f 66 | the ord|ering of|
|00001620| 20 66 69 65 6c 64 73 20 | 77 69 74 68 69 6e 20 61 | fields |within a|
|00001630| 20 52 65 63 74 20 2a 2f | 0d 23 64 65 66 69 6e 65 | Rect */|.#define|
|00001640| 20 54 6f 70 4c 65 66 74 | 28 61 52 65 63 74 29 09 | TopLeft|(aRect).|
|00001650| 28 2a 20 28 50 6f 69 6e | 74 20 2a 29 20 26 28 61 |(* (Poin|t *) &(a|
|00001660| 52 65 63 74 29 2e 74 6f | 70 29 0d 23 64 65 66 69 |Rect).to|p).#defi|
|00001670| 6e 65 20 42 6f 74 52 69 | 67 68 74 28 61 52 65 63 |ne BotRi|ght(aRec|
|00001680| 74 29 09 28 2a 20 28 50 | 6f 69 6e 74 20 2a 29 20 |t).(* (P|oint *) |
|00001690| 26 28 61 52 65 63 74 29 | 2e 62 6f 74 74 6f 6d 29 |&(aRect)|.bottom)|
|000016a0| 0d 0d 0d 65 78 74 65 72 | 6e 20 76 6f 69 64 20 5f |...exter|n void _|
|000016b0| 44 61 74 61 49 6e 69 74 | 28 29 3b 0d 0d 2f 2a 20 |DataInit|();../* |
|000016c0| 54 68 69 73 20 72 6f 75 | 74 69 6e 65 20 69 73 20 |This rou|tine is |
|000016d0| 70 61 72 74 20 6f 66 20 | 74 68 65 20 4d 50 57 20 |part of |the MPW |
|000016e0| 72 75 6e 74 69 6d 65 20 | 6c 69 62 72 61 72 79 2e |runtime |library.|
|000016f0| 20 54 68 69 73 20 65 78 | 74 65 72 6e 61 6c 0d 20 | This ex|ternal. |
|00001700| 20 20 72 65 66 65 72 65 | 6e 63 65 20 74 6f 20 69 | refere|nce to i|
|00001710| 74 20 69 73 20 64 6f 6e | 65 20 73 6f 20 74 68 61 |t is don|e so tha|
|00001720| 74 20 77 65 20 63 61 6e | 20 75 6e 6c 6f 61 64 20 |t we can| unload |
|00001730| 69 74 73 20 73 65 67 6d | 65 6e 74 2c 20 25 41 35 |its segm|ent, %A5|
|00001740| 49 6e 69 74 2e 20 2a 2f | 0d 0d 0d 23 70 72 61 67 |Init. */|...#prag|
|00001750| 6d 61 20 73 65 67 6d 65 | 6e 74 20 4d 61 69 6e 0d |ma segme|nt Main.|
|00001760| 6d 61 69 6e 28 29 0d 7b | 0d 09 57 69 6e 64 6f 77 |main().{|..Window|
|00001770| 50 74 72 09 77 69 6e 64 | 6f 77 3b 0d 0d 09 55 6e |Ptr.wind|ow;...Un|
|00001780| 6c 6f 61 64 53 65 67 28 | 28 50 74 72 29 20 5f 44 |loadSeg(|(Ptr) _D|
|00001790| 61 74 61 49 6e 69 74 29 | 3b 09 09 2f 2a 20 6e 6f |ataInit)|;../* no|
|000017a0| 74 65 20 74 68 61 74 20 | 5f 44 61 74 61 49 6e 69 |te that |_DataIni|
|000017b0| 74 20 6d 75 73 74 20 6e | 6f 74 20 62 65 20 69 6e |t must n|ot be in|
|000017c0| 20 4d 61 69 6e 21 20 2a | 2f 0d 09 0d 09 2f 2a 20 | Main! *|/..../* |
|000017d0| 31 2e 30 31 20 2d 20 63 | 61 6c 6c 20 74 6f 20 46 |1.01 - c|all to F|
|000017e0| 6f 72 63 65 45 6e 76 69 | 72 6f 6e 73 20 72 65 6d |orceEnvi|rons rem|
|000017f0| 6f 76 65 64 20 2a 2f 0d | 09 0d 09 2f 2a 09 49 66 |oved */.|.../*.If|
|00001800| 20 79 6f 75 20 68 61 76 | 65 20 73 74 61 63 6b 20 | you hav|e stack |
|00001810| 72 65 71 75 69 72 65 6d | 65 6e 74 73 20 74 68 61 |requirem|ents tha|
|00001820| 74 20 64 69 66 66 65 72 | 20 66 72 6f 6d 20 74 68 |t differ| from th|
|00001830| 65 20 64 65 66 61 75 6c | 74 2c 0d 09 09 74 68 65 |e defaul|t,...the|
|00001840| 6e 20 79 6f 75 20 63 6f | 75 6c 64 20 75 73 65 20 |n you co|uld use |
|00001850| 53 65 74 41 70 70 6c 4c | 69 6d 69 74 20 74 6f 20 |SetApplL|imit to |
|00001860| 69 6e 63 72 65 61 73 65 | 20 53 74 61 63 6b 53 70 |increase| StackSp|
|00001870| 61 63 65 20 61 74 20 0d | 09 09 74 68 69 73 20 70 |ace at .|..this p|
|00001880| 6f 69 6e 74 2c 20 62 65 | 66 6f 72 65 20 63 61 6c |oint, be|fore cal|
|00001890| 6c 69 6e 67 20 4d 61 78 | 41 70 70 6c 5a 6f 6e 65 |ling Max|ApplZone|
|000018a0| 2e 20 2a 2f 0d 09 4d 61 | 78 41 70 70 6c 5a 6f 6e |. */..Ma|xApplZon|
|000018b0| 65 28 29 3b 09 09 09 09 | 09 2f 2a 20 65 78 70 61 |e();....|./* expa|
|000018c0| 6e 64 20 74 68 65 20 68 | 65 61 70 20 73 6f 20 63 |nd the h|eap so c|
|000018d0| 6f 64 65 20 73 65 67 6d | 65 6e 74 73 20 6c 6f 61 |ode segm|ents loa|
|000018e0| 64 20 61 74 20 74 68 65 | 20 74 6f 70 20 2a 2f 0d |d at the| top */.|
|000018f0| 0d 09 49 6e 69 74 69 61 | 6c 69 7a 65 28 26 77 69 |..Initia|lize(&wi|
|00001900| 6e 64 6f 77 29 3b 09 09 | 09 09 2f 2a 20 69 6e 69 |ndow);..|../* ini|
|00001910| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 70 72 6f 67 |tialize |the prog|
|00001920| 72 61 6d 20 2a 2f 0d 09 | 55 6e 6c 6f 61 64 53 65 |ram */..|UnloadSe|
|00001930| 67 28 28 50 74 72 29 20 | 49 6e 69 74 69 61 6c 69 |g((Ptr) |Initiali|
|00001940| 7a 65 29 3b 09 2f 2a 20 | 6e 6f 74 65 20 74 68 61 |ze);./* |note tha|
|00001950| 74 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 6d 75 73 |t Initia|lize mus|
|00001960| 74 20 6e 6f 74 20 62 65 | 20 69 6e 20 4d 61 69 6e |t not be| in Main|
|00001970| 21 20 2a 2f 0d 09 49 6e | 73 74 61 6c 6c 43 56 42 |! */..In|stallCVB|
|00001980| 4c 28 29 3b 09 09 09 09 | 09 2f 2a 20 64 65 6d 6f |L();....|./* demo|
|00001990| 20 6f 75 72 20 56 42 4c | 20 74 61 73 6b 20 2a 2f | our VBL| task */|
|000019a0| 0d 09 69 66 20 28 77 69 | 6e 64 6f 77 29 0d 09 09 |..if (wi|ndow)...|
|000019b0| 53 68 6f 77 57 69 6e 64 | 6f 77 20 28 77 69 6e 64 |ShowWind|ow (wind|
|000019c0| 6f 77 29 3b 09 09 2f 2a | 20 73 68 6f 77 20 74 72 |ow);../*| show tr|
|000019d0| 61 66 66 69 63 20 6c 69 | 67 68 74 20 77 69 6e 64 |affic li|ght wind|
|000019e0| 6f 77 20 2a 2f 0d 09 45 | 76 65 6e 74 4c 6f 6f 70 |ow */..E|ventLoop|
|000019f0| 28 29 3b 09 09 09 09 09 | 2f 2a 20 63 61 6c 6c 20 |();.....|/* call |
|00001a00| 74 68 65 20 6d 61 69 6e | 20 65 76 65 6e 74 20 6c |the main| event l|
|00001a10| 6f 6f 70 20 2a 2f 0d 7d | 0d 0d 0d 2f 2a 09 47 65 |oop */.}|.../*.Ge|
|00001a20| 74 20 65 76 65 6e 74 73 | 20 66 6f 72 65 76 65 72 |t events| forever|
|00001a30| 2c 20 61 6e 64 20 68 61 | 6e 64 6c 65 20 74 68 65 |, and ha|ndle the|
|00001a40| 6d 20 62 79 20 63 61 6c | 6c 69 6e 67 20 44 6f 45 |m by cal|ling DoE|
|00001a50| 76 65 6e 74 2e 0d 09 47 | 65 74 20 74 68 65 20 65 |vent...G|et the e|
|00001a60| 76 65 6e 74 73 20 62 79 | 20 63 61 6c 6c 69 6e 67 |vents by| calling|
|00001a70| 20 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 2c 20 | WaitNex|tEvent, |
|00001a80| 69 66 20 69 74 27 73 20 | 61 76 61 69 6c 61 62 6c |if it's |availabl|
|00001a90| 65 2c 20 6f 74 68 65 72 | 77 69 73 65 0d 09 62 79 |e, other|wise..by|
|00001aa0| 20 63 61 6c 6c 69 6e 67 | 20 47 65 74 4e 65 78 74 | calling| GetNext|
|00001ab0| 45 76 65 6e 74 2e 20 41 | 6c 73 6f 20 63 61 6c 6c |Event. A|lso call|
|00001ac0| 20 41 64 6a 75 73 74 43 | 75 72 73 6f 72 20 65 61 | AdjustC|ursor ea|
|00001ad0| 63 68 20 74 69 6d 65 20 | 74 68 72 6f 75 67 68 20 |ch time |through |
|00001ae0| 74 68 65 20 6c 6f 6f 70 | 2e 20 2a 2f 0d 0d 23 70 |the loop|. */..#p|
|00001af0| 72 61 67 6d 61 20 73 65 | 67 6d 65 6e 74 20 4d 61 |ragma se|gment Ma|
|00001b00| 69 6e 0d 76 6f 69 64 20 | 45 76 65 6e 74 4c 6f 6f |in.void |EventLoo|
|00001b10| 70 28 29 0d 7b 0d 09 52 | 67 6e 48 61 6e 64 6c 65 |p().{..R|gnHandle|
|00001b20| 09 63 75 72 73 6f 72 52 | 67 6e 3b 0d 09 42 6f 6f |.cursorR|gn;..Boo|
|00001b30| 6c 65 61 6e 09 09 67 6f | 74 45 76 65 6e 74 3b 0d |lean..go|tEvent;.|
|00001b40| 09 45 76 65 6e 74 52 65 | 63 6f 72 64 09 65 76 65 |.EventRe|cord.eve|
|00001b50| 6e 74 3b 0d 09 50 6f 69 | 6e 74 09 09 6d 6f 75 73 |nt;..Poi|nt..mous|
|00001b60| 65 3b 0d 0d 09 63 75 72 | 73 6f 72 52 67 6e 20 3d |e;...cur|sorRgn =|
|00001b70| 20 4e 65 77 52 67 6e 28 | 29 3b 09 09 09 2f 2a 20 | NewRgn(|);.../* |
|00001b80| 77 65 d5 6c 6c 20 70 61 | 73 73 20 57 4e 45 20 61 |we.ll pa|ss WNE a|
|00001b90| 6e 20 65 6d 70 74 79 20 | 72 65 67 69 6f 6e 20 74 |n empty |region t|
|00001ba0| 68 65 20 31 73 74 20 74 | 69 6d 65 20 74 68 72 75 |he 1st t|ime thru|
|00001bb0| 20 2a 2f 0d 09 64 6f 20 | 7b 0d 09 09 2f 2a 20 75 | */..do |{.../* u|
|00001bc0| 73 65 20 57 4e 45 20 69 | 66 20 69 74 20 69 73 20 |se WNE i|f it is |
|00001bd0| 61 76 61 69 6c 61 62 6c | 65 20 2a 2f 0d 09 09 69 |availabl|e */...i|
|00001be0| 66 20 28 20 67 48 61 73 | 57 61 69 74 4e 65 78 74 |f ( gHas|WaitNext|
|00001bf0| 45 76 65 6e 74 20 29 20 | 7b 0d 09 09 09 47 65 74 |Event ) |{....Get|
|00001c00| 47 6c 6f 62 61 6c 4d 6f | 75 73 65 28 26 6d 6f 75 |GlobalMo|use(&mou|
|00001c10| 73 65 29 3b 0d 09 09 09 | 41 64 6a 75 73 74 43 75 |se);....|AdjustCu|
|00001c20| 72 73 6f 72 28 6d 6f 75 | 73 65 2c 20 63 75 72 73 |rsor(mou|se, curs|
|00001c30| 6f 72 52 67 6e 29 3b 0d | 09 09 09 67 6f 74 45 76 |orRgn);.|...gotEv|
|00001c40| 65 6e 74 20 3d 20 57 61 | 69 74 4e 65 78 74 45 76 |ent = Wa|itNextEv|
|00001c50| 65 6e 74 28 65 76 65 72 | 79 45 76 65 6e 74 2c 20 |ent(ever|yEvent, |
|00001c60| 26 65 76 65 6e 74 2c 20 | 4d 41 58 4c 4f 4e 47 2c |&event, |MAXLONG,|
|00001c70| 20 63 75 72 73 6f 72 52 | 67 6e 29 3b 0d 09 09 7d | cursorR|gn);...}|
|00001c80| 0d 09 09 65 6c 73 65 20 | 7b 0d 09 09 09 53 79 73 |...else |{....Sys|
|00001c90| 74 65 6d 54 61 73 6b 28 | 29 3b 0d 09 09 09 67 6f |temTask(|);....go|
|00001ca0| 74 45 76 65 6e 74 20 3d | 20 47 65 74 4e 65 78 74 |tEvent =| GetNext|
|00001cb0| 45 76 65 6e 74 28 65 76 | 65 72 79 45 76 65 6e 74 |Event(ev|eryEvent|
|00001cc0| 2c 20 26 65 76 65 6e 74 | 29 3b 0d 09 09 7d 0d 09 |, &event|);...}..|
|00001cd0| 09 69 66 20 28 20 67 6f | 74 45 76 65 6e 74 20 29 |.if ( go|tEvent )|
|00001ce0| 20 7b 0d 09 09 09 2f 2a | 20 6d 61 6b 65 20 73 75 | {..../*| make su|
|00001cf0| 72 65 20 77 65 20 68 61 | 76 65 20 74 68 65 20 72 |re we ha|ve the r|
|00001d00| 69 67 68 74 20 63 75 72 | 73 6f 72 20 62 65 66 6f |ight cur|sor befo|
|00001d10| 72 65 20 68 61 6e 64 6c | 69 6e 67 20 74 68 65 20 |re handl|ing the |
|00001d20| 65 76 65 6e 74 20 2a 2f | 0d 09 09 09 41 64 6a 75 |event */|....Adju|
|00001d30| 73 74 43 75 72 73 6f 72 | 28 65 76 65 6e 74 2e 77 |stCursor|(event.w|
|00001d40| 68 65 72 65 2c 20 63 75 | 72 73 6f 72 52 67 6e 29 |here, cu|rsorRgn)|
|00001d50| 3b 0d 09 09 09 44 6f 45 | 76 65 6e 74 28 26 65 76 |;....DoE|vent(&ev|
|00001d60| 65 6e 74 29 3b 0d 09 09 | 7d 0d 09 09 2f 2a 09 49 |ent);...|}.../*.I|
|00001d70| 66 20 79 6f 75 20 61 72 | 65 20 75 73 69 6e 67 20 |f you ar|e using |
|00001d80| 6d 6f 64 65 6c 65 73 73 | 20 64 69 61 6c 6f 67 73 |modeless| dialogs|
|00001d90| 20 74 68 61 74 20 68 61 | 76 65 20 65 64 69 74 54 | that ha|ve editT|
|00001da0| 65 78 74 20 69 74 65 6d | 73 2c 0d 09 09 09 79 6f |ext item|s,....yo|
|00001db0| 75 20 77 69 6c 6c 20 77 | 61 6e 74 20 74 6f 20 63 |u will w|ant to c|
|00001dc0| 61 6c 6c 20 49 73 44 69 | 61 6c 6f 67 45 76 65 6e |all IsDi|alogEven|
|00001dd0| 74 20 74 6f 20 67 69 76 | 65 20 74 68 65 20 63 61 |t to giv|e the ca|
|00001de0| 72 65 74 20 61 20 63 68 | 61 6e 63 65 0d 09 09 09 |ret a ch|ance....|
|00001df0| 74 6f 20 62 6c 69 6e 6b | 2c 20 65 76 65 6e 20 69 |to blink|, even i|
|00001e00| 66 20 57 4e 45 2f 47 4e | 45 20 72 65 74 75 72 6e |f WNE/GN|E return|
|00001e10| 65 64 20 46 41 4c 53 45 | 2e 20 48 6f 77 65 76 65 |ed FALSE|. Howeve|
|00001e20| 72 2c 20 63 68 65 63 6b | 20 46 72 6f 6e 74 57 69 |r, check| FrontWi|
|00001e30| 6e 64 6f 77 0d 09 09 09 | 66 6f 72 20 61 20 6e 6f |ndow....|for a no|
|00001e40| 6e 2d 4e 49 4c 20 76 61 | 6c 75 65 20 62 65 66 6f |n-NIL va|lue befo|
|00001e50| 72 65 20 63 61 6c 6c 69 | 6e 67 20 49 73 44 69 61 |re calli|ng IsDia|
|00001e60| 6c 6f 67 45 76 65 6e 74 | 2e 20 2a 2f 0d 09 7d 20 |logEvent|. */..} |
|00001e70| 77 68 69 6c 65 20 28 20 | 74 72 75 65 20 29 3b 09 |while ( |true );.|
|00001e80| 2f 2a 20 6c 6f 6f 70 20 | 66 6f 72 65 76 65 72 3b |/* loop |forever;|
|00001e90| 20 77 65 20 71 75 69 74 | 20 76 69 61 20 45 78 69 | we quit| via Exi|
|00001ea0| 74 54 6f 53 68 65 6c 6c | 20 2a 2f 0d 7d 20 2f 2a |tToShell| */.} /*|
|00001eb0| 45 76 65 6e 74 4c 6f 6f | 70 2a 2f 0d 0d 0d 2f 2a |EventLoo|p*/.../*|
|00001ec0| 20 44 6f 20 74 68 65 20 | 72 69 67 68 74 20 74 68 | Do the |right th|
|00001ed0| 69 6e 67 20 66 6f 72 20 | 61 6e 20 65 76 65 6e 74 |ing for |an event|
|00001ee0| 2e 20 44 65 74 65 72 6d | 69 6e 65 20 77 68 61 74 |. Determ|ine what|
|00001ef0| 20 6b 69 6e 64 20 6f 66 | 20 65 76 65 6e 74 20 69 | kind of| event i|
|00001f00| 74 20 69 73 2c 20 61 6e | 64 20 63 61 6c 6c 0d 20 |t is, an|d call. |
|00001f10| 74 68 65 20 61 70 70 72 | 6f 70 72 69 61 74 65 20 |the appr|opriate |
|00001f20| 72 6f 75 74 69 6e 65 73 | 2e 20 2a 2f 0d 0d 23 70 |routines|. */..#p|
|00001f30| 72 61 67 6d 61 20 73 65 | 67 6d 65 6e 74 20 4d 61 |ragma se|gment Ma|
|00001f40| 69 6e 0d 76 6f 69 64 20 | 44 6f 45 76 65 6e 74 28 |in.void |DoEvent(|
|00001f50| 65 76 65 6e 74 29 0d 09 | 45 76 65 6e 74 52 65 63 |event)..|EventRec|
|00001f60| 6f 72 64 09 2a 65 76 65 | 6e 74 3b 0d 7b 0d 09 73 |ord.*eve|nt;.{..s|
|00001f70| 68 6f 72 74 09 09 70 61 | 72 74 2c 20 65 72 72 3b |hort..pa|rt, err;|
|00001f80| 0d 09 57 69 6e 64 6f 77 | 50 74 72 09 77 69 6e 64 |..Window|Ptr.wind|
|00001f90| 6f 77 3b 0d 09 42 6f 6f | 6c 65 61 6e 09 09 68 69 |ow;..Boo|lean..hi|
|00001fa0| 74 3b 0d 09 63 68 61 72 | 09 09 6b 65 79 3b 0d 09 |t;..char|..key;..|
|00001fb0| 50 6f 69 6e 74 09 09 61 | 50 6f 69 6e 74 3b 0d 0d |Point..a|Point;..|
|00001fc0| 09 73 77 69 74 63 68 20 | 28 20 65 76 65 6e 74 2d |.switch |( event-|
|00001fd0| 3e 77 68 61 74 20 29 20 | 7b 0d 09 09 63 61 73 65 |>what ) |{...case|
|00001fe0| 20 6d 6f 75 73 65 44 6f | 77 6e 3a 0d 09 09 09 70 | mouseDo|wn:....p|
|00001ff0| 61 72 74 20 3d 20 46 69 | 6e 64 57 69 6e 64 6f 77 |art = Fi|ndWindow|
|00002000| 28 65 76 65 6e 74 2d 3e | 77 68 65 72 65 2c 20 26 |(event->|where, &|
|00002010| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 73 77 69 74 |window);|....swit|
|00002020| 63 68 20 28 20 70 61 72 | 74 20 29 20 7b 0d 09 09 |ch ( par|t ) {...|
|00002030| 09 09 63 61 73 65 20 69 | 6e 4d 65 6e 75 42 61 72 |..case i|nMenuBar|
|00002040| 3a 09 09 09 09 2f 2a 20 | 70 72 6f 63 65 73 73 20 |:..../* |process |
|00002050| 61 20 6d 6f 75 73 65 20 | 6d 65 6e 75 20 63 6f 6d |a mouse |menu com|
|00002060| 6d 61 6e 64 20 28 69 66 | 20 61 6e 79 29 20 2a 2f |mand (if| any) */|
|00002070| 0d 09 09 09 09 09 41 64 | 6a 75 73 74 4d 65 6e 75 |......Ad|justMenu|
|00002080| 73 28 29 3b 0d 09 09 09 | 09 09 44 6f 4d 65 6e 75 |s();....|..DoMenu|
|00002090| 43 6f 6d 6d 61 6e 64 28 | 4d 65 6e 75 53 65 6c 65 |Command(|MenuSele|
|000020a0| 63 74 28 65 76 65 6e 74 | 2d 3e 77 68 65 72 65 29 |ct(event|->where)|
|000020b0| 29 3b 0d 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |);......|break;..|
|000020c0| 09 09 09 63 61 73 65 20 | 69 6e 53 79 73 57 69 6e |...case |inSysWin|
|000020d0| 64 6f 77 3a 09 09 09 2f | 2a 20 6c 65 74 20 74 68 |dow:.../|* let th|
|000020e0| 65 20 73 79 73 74 65 6d | 20 68 61 6e 64 6c 65 20 |e system| handle |
|000020f0| 74 68 65 20 6d 6f 75 73 | 65 44 6f 77 6e 20 2a 2f |the mous|eDown */|
|00002100| 0d 09 09 09 09 09 53 79 | 73 74 65 6d 43 6c 69 63 |......Sy|stemClic|
|00002110| 6b 28 65 76 65 6e 74 2c | 20 77 69 6e 64 6f 77 29 |k(event,| window)|
|00002120| 3b 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |;......b|reak;...|
|00002130| 09 09 63 61 73 65 20 69 | 6e 43 6f 6e 74 65 6e 74 |..case i|nContent|
|00002140| 3a 0d 09 09 09 09 09 69 | 66 20 28 20 77 69 6e 64 |:......i|f ( wind|
|00002150| 6f 77 20 21 3d 20 46 72 | 6f 6e 74 57 69 6e 64 6f |ow != Fr|ontWindo|
|00002160| 77 28 29 20 29 20 7b 0d | 09 09 09 09 09 09 53 65 |w() ) {.|......Se|
|00002170| 6c 65 63 74 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |lectWind|ow(windo|
|00002180| 77 29 3b 0d 09 09 09 09 | 09 09 2f 2a 44 6f 45 76 |w);.....|../*DoEv|
|00002190| 65 6e 74 28 65 76 65 6e | 74 29 3b 2a 2f 09 2f 2a |ent(even|t);*/./*|
|000021a0| 20 75 73 65 20 74 68 69 | 73 20 6c 69 6e 65 20 66 | use thi|s line f|
|000021b0| 6f 72 20 22 64 6f 20 66 | 69 72 73 74 20 63 6c 69 |or "do f|irst cli|
|000021c0| 63 6b 22 20 2a 2f 0d 09 | 09 09 09 09 7d 20 65 6c |ck" */..|....} el|
|000021d0| 73 65 0d 09 09 09 09 09 | 09 44 6f 43 6f 6e 74 65 |se......|.DoConte|
|000021e0| 6e 74 43 6c 69 63 6b 28 | 77 69 6e 64 6f 77 29 3b |ntClick(|window);|
|000021f0| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00002200| 09 63 61 73 65 20 69 6e | 44 72 61 67 3a 09 09 09 |.case in|Drag:...|
|00002210| 09 2f 2a 20 70 61 73 73 | 20 73 63 72 65 65 6e 42 |./* pass| screenB|
|00002220| 69 74 73 2e 62 6f 75 6e | 64 73 20 74 6f 20 67 65 |its.boun|ds to ge|
|00002230| 74 20 61 6c 6c 20 67 44 | 65 76 69 63 65 73 20 2a |t all gD|evices *|
|00002240| 2f 0d 09 09 09 09 09 44 | 72 61 67 57 69 6e 64 6f |/......D|ragWindo|
|00002250| 77 28 77 69 6e 64 6f 77 | 2c 20 65 76 65 6e 74 2d |w(window|, event-|
|00002260| 3e 77 68 65 72 65 2c 20 | 26 71 64 2e 73 63 72 65 |>where, |&qd.scre|
|00002270| 65 6e 42 69 74 73 2e 62 | 6f 75 6e 64 73 29 3b 0d |enBits.b|ounds);.|
|00002280| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....|
|00002290| 63 61 73 65 20 69 6e 47 | 72 6f 77 3a 0d 09 09 09 |case inG|row:....|
|000022a0| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 09 63 61 73 |..break;|.....cas|
|000022b0| 65 20 69 6e 5a 6f 6f 6d | 49 6e 3a 0d 09 09 09 09 |e inZoom|In:.....|
|000022c0| 63 61 73 65 20 69 6e 5a | 6f 6f 6d 4f 75 74 3a 0d |case inZ|oomOut:.|
|000022d0| 09 09 09 09 09 68 69 74 | 20 3d 20 54 72 61 63 6b |.....hit| = Track|
|000022e0| 42 6f 78 28 77 69 6e 64 | 6f 77 2c 20 65 76 65 6e |Box(wind|ow, even|
|000022f0| 74 2d 3e 77 68 65 72 65 | 2c 20 70 61 72 74 29 3b |t->where|, part);|
|00002300| 0d 09 09 09 09 09 69 66 | 20 28 20 68 69 74 20 29 |......if| ( hit )|
|00002310| 20 7b 0d 09 09 09 09 09 | 09 53 65 74 50 6f 72 74 | {......|.SetPort|
|00002320| 28 77 69 6e 64 6f 77 29 | 3b 09 09 09 09 2f 2a 20 |(window)|;..../* |
|00002330| 74 68 65 20 77 69 6e 64 | 6f 77 20 6d 75 73 74 20 |the wind|ow must |
|00002340| 62 65 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 70 |be the c|urrent p|
|00002350| 6f 72 74 2e 2e 2e 20 2a | 2f 0d 09 09 09 09 09 09 |ort... *|/.......|
|00002360| 45 72 61 73 65 52 65 63 | 74 28 26 77 69 6e 64 6f |EraseRec|t(&windo|
|00002370| 77 2d 3e 70 6f 72 74 52 | 65 63 74 29 3b 09 2f 2a |w->portR|ect);./*|
|00002380| 20 62 65 63 61 75 73 65 | 20 6f 66 20 61 20 62 75 | because| of a bu|
|00002390| 67 20 69 6e 20 5a 6f 6f | 6d 57 69 6e 64 6f 77 20 |g in Zoo|mWindow |
|000023a0| 2a 2f 0d 09 09 09 09 09 | 09 5a 6f 6f 6d 57 69 6e |*/......|.ZoomWin|
|000023b0| 64 6f 77 28 77 69 6e 64 | 6f 77 2c 20 70 61 72 74 |dow(wind|ow, part|
|000023c0| 2c 20 74 72 75 65 29 3b | 09 2f 2a 20 6e 6f 74 65 |, true);|./* note|
|000023d0| 20 74 68 61 74 20 77 65 | 20 69 6e 76 61 6c 69 64 | that we| invalid|
|000023e0| 61 74 65 20 61 6e 64 20 | 65 72 61 73 65 2e 2e 2e |ate and |erase...|
|000023f0| 20 2a 2f 0d 09 09 09 09 | 09 09 49 6e 76 61 6c 52 | */.....|..InvalR|
|00002400| 65 63 74 28 26 77 69 6e | 64 6f 77 2d 3e 70 6f 72 |ect(&win|dow->por|
|00002410| 74 52 65 63 74 29 3b 09 | 2f 2a 20 74 6f 20 6d 61 |tRect);.|/* to ma|
|00002420| 6b 65 20 74 68 69 6e 67 | 73 20 6c 6f 6f 6b 20 62 |ke thing|s look b|
|00002430| 65 74 74 65 72 20 6f 6e | 2d 73 63 72 65 65 6e 20 |etter on|-screen |
|00002440| 2a 2f 0d 09 09 09 09 09 | 7d 0d 09 09 09 09 09 62 |*/......|}......b|
|00002450| 72 65 61 6b 3b 0d 09 09 | 09 7d 0d 09 09 09 62 72 |reak;...|.}....br|
|00002460| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 6b 65 79 44 |eak;...c|ase keyD|
|00002470| 6f 77 6e 3a 0d 09 09 63 | 61 73 65 20 61 75 74 6f |own:...c|ase auto|
|00002480| 4b 65 79 3a 09 09 09 09 | 09 09 2f 2a 20 63 68 65 |Key:....|../* che|
|00002490| 63 6b 20 66 6f 72 20 6d | 65 6e 75 6b 65 79 20 65 |ck for m|enukey e|
|000024a0| 71 75 69 76 61 6c 65 6e | 74 73 20 2a 2f 0d 09 09 |quivalen|ts */...|
|000024b0| 09 6b 65 79 20 3d 20 65 | 76 65 6e 74 2d 3e 6d 65 |.key = e|vent->me|
|000024c0| 73 73 61 67 65 20 26 20 | 63 68 61 72 43 6f 64 65 |ssage & |charCode|
|000024d0| 4d 61 73 6b 3b 0d 09 09 | 09 69 66 20 28 20 65 76 |Mask;...|.if ( ev|
|000024e0| 65 6e 74 2d 3e 6d 6f 64 | 69 66 69 65 72 73 20 26 |ent->mod|ifiers &|
|000024f0| 20 63 6d 64 4b 65 79 20 | 29 09 09 09 2f 2a 20 43 | cmdKey |).../* C|
|00002500| 6f 6d 6d 61 6e 64 20 6b | 65 79 20 64 6f 77 6e 20 |ommand k|ey down |
|00002510| 2a 2f 0d 09 09 09 09 69 | 66 20 28 20 65 76 65 6e |*/.....i|f ( even|
|00002520| 74 2d 3e 77 68 61 74 20 | 3d 3d 20 6b 65 79 44 6f |t->what |== keyDo|
|00002530| 77 6e 20 29 20 7b 0d 09 | 09 09 09 09 41 64 6a 75 |wn ) {..|....Adju|
|00002540| 73 74 4d 65 6e 75 73 28 | 29 3b 09 09 09 09 09 09 |stMenus(|);......|
|00002550| 2f 2a 20 65 6e 61 62 6c | 65 2f 64 69 73 61 62 6c |/* enabl|e/disabl|
|00002560| 65 2f 63 68 65 63 6b 20 | 6d 65 6e 75 20 69 74 65 |e/check |menu ite|
|00002570| 6d 73 20 70 72 6f 70 65 | 72 6c 79 20 2a 2f 0d 09 |ms prope|rly */..|
|00002580| 09 09 09 09 44 6f 4d 65 | 6e 75 43 6f 6d 6d 61 6e |....DoMe|nuComman|
|00002590| 64 28 4d 65 6e 75 4b 65 | 79 28 6b 65 79 29 29 3b |d(MenuKe|y(key));|
|000025a0| 0d 09 09 09 09 7d 0d 09 | 09 09 62 72 65 61 6b 3b |.....}..|..break;|
|000025b0| 0d 09 09 63 61 73 65 20 | 61 63 74 69 76 61 74 65 |...case |activate|
|000025c0| 45 76 74 3a 0d 09 09 09 | 44 6f 41 63 74 69 76 61 |Evt:....|DoActiva|
|000025d0| 74 65 28 28 57 69 6e 64 | 6f 77 50 74 72 29 20 65 |te((Wind|owPtr) e|
|000025e0| 76 65 6e 74 2d 3e 6d 65 | 73 73 61 67 65 2c 20 28 |vent->me|ssage, (|
|000025f0| 65 76 65 6e 74 2d 3e 6d | 6f 64 69 66 69 65 72 73 |event->m|odifiers|
|00002600| 20 26 20 61 63 74 69 76 | 65 46 6c 61 67 29 20 21 | & activ|eFlag) !|
|00002610| 3d 20 30 29 3b 0d 09 09 | 09 62 72 65 61 6b 3b 0d |= 0);...|.break;.|
|00002620| 09 09 63 61 73 65 20 75 | 70 64 61 74 65 45 76 74 |..case u|pdateEvt|
|00002630| 3a 0d 09 09 09 44 6f 55 | 70 64 61 74 65 28 28 57 |:....DoU|pdate((W|
|00002640| 69 6e 64 6f 77 50 74 72 | 29 20 65 76 65 6e 74 2d |indowPtr|) event-|
|00002650| 3e 6d 65 73 73 61 67 65 | 29 3b 0d 09 09 09 62 72 |>message|);....br|
|00002660| 65 61 6b 3b 0d 09 09 2f | 2a 09 31 2e 30 31 20 2d |eak;.../|*.1.01 -|
|00002670| 20 49 74 20 69 73 20 6e | 6f 74 20 61 20 62 61 64 | It is n|ot a bad|
|00002680| 20 69 64 65 61 20 74 6f | 20 61 74 20 6c 65 61 73 | idea to| at leas|
|00002690| 74 20 63 61 6c 6c 20 44 | 49 42 61 64 4d 6f 75 6e |t call D|IBadMoun|
|000026a0| 74 20 69 6e 20 72 65 73 | 70 6f 6e 73 65 0d 09 09 |t in res|ponse...|
|000026b0| 09 74 6f 20 61 20 64 69 | 73 6b 45 76 74 2c 20 73 |.to a di|skEvt, s|
|000026c0| 6f 20 74 68 61 74 20 74 | 68 65 20 75 73 65 72 20 |o that t|he user |
|000026d0| 63 61 6e 20 66 6f 72 6d | 61 74 20 61 20 66 6c 6f |can form|at a flo|
|000026e0| 70 70 79 2e 20 2a 2f 0d | 09 09 63 61 73 65 20 64 |ppy. */.|..case d|
|000026f0| 69 73 6b 45 76 74 3a 0d | 09 09 09 69 66 20 28 20 |iskEvt:.|...if ( |
|00002700| 48 69 57 6f 72 64 28 65 | 76 65 6e 74 2d 3e 6d 65 |HiWord(e|vent->me|
|00002710| 73 73 61 67 65 29 20 21 | 3d 20 6e 6f 45 72 72 20 |ssage) !|= noErr |
|00002720| 29 20 7b 0d 09 09 09 09 | 53 65 74 50 74 28 26 61 |) {.....|SetPt(&a|
|00002730| 50 6f 69 6e 74 2c 20 6b | 44 49 4c 65 66 74 2c 20 |Point, k|DILeft, |
|00002740| 6b 44 49 54 6f 70 29 3b | 0d 09 09 09 09 65 72 72 |kDITop);|.....err|
|00002750| 20 3d 20 44 49 42 61 64 | 4d 6f 75 6e 74 28 61 50 | = DIBad|Mount(aP|
|00002760| 6f 69 6e 74 2c 20 65 76 | 65 6e 74 2d 3e 6d 65 73 |oint, ev|ent->mes|
|00002770| 73 61 67 65 29 3b 0d 09 | 09 09 7d 0d 09 09 09 62 |sage);..|..}....b|
|00002780| 72 65 61 6b 3b 0d 09 09 | 63 61 73 65 20 6b 4f 53 |reak;...|case kOS|
|00002790| 45 76 65 6e 74 3a 0d 09 | 09 2f 2a 09 31 2e 30 32 |Event:..|./*.1.02|
|000027a0| 20 2d 20 6d 75 73 74 20 | 42 69 74 41 4e 44 20 77 | - must |BitAND w|
|000027b0| 69 74 68 20 30 78 30 46 | 46 20 74 6f 20 67 65 74 |ith 0x0F|F to get|
|000027c0| 20 6f 6e 6c 79 20 6c 6f | 77 20 62 79 74 65 20 2a | only lo|w byte *|
|000027d0| 2f 0d 09 09 09 73 77 69 | 74 63 68 20 28 28 65 76 |/....swi|tch ((ev|
|000027e0| 65 6e 74 2d 3e 6d 65 73 | 73 61 67 65 20 3e 3e 20 |ent->mes|sage >> |
|000027f0| 32 34 29 20 26 20 30 78 | 30 46 46 29 20 7b 09 09 |24) & 0x|0FF) {..|
|00002800| 2f 2a 20 68 69 67 68 20 | 62 79 74 65 20 6f 66 20 |/* high |byte of |
|00002810| 6d 65 73 73 61 67 65 20 | 2a 2f 0d 09 09 09 09 63 |message |*/.....c|
|00002820| 61 73 65 20 6b 53 75 73 | 70 65 6e 64 52 65 73 75 |ase kSus|pendResu|
|00002830| 6d 65 4d 65 73 73 61 67 | 65 3a 09 09 2f 2a 20 73 |meMessag|e:../* s|
|00002840| 75 73 70 65 6e 64 2f 72 | 65 73 75 6d 65 20 69 73 |uspend/r|esume is|
|00002850| 20 61 6c 73 6f 20 61 6e | 20 61 63 74 69 76 61 74 | also an| activat|
|00002860| 65 2f 64 65 61 63 74 69 | 76 61 74 65 20 2a 2f 0d |e/deacti|vate */.|
|00002870| 09 09 09 09 09 67 49 6e | 42 61 63 6b 67 72 6f 75 |.....gIn|Backgrou|
|00002880| 6e 64 20 3d 20 28 65 76 | 65 6e 74 2d 3e 6d 65 73 |nd = (ev|ent->mes|
|00002890| 73 61 67 65 20 26 20 6b | 52 65 73 75 6d 65 4d 61 |sage & k|ResumeMa|
|000028a0| 73 6b 29 20 3d 3d 20 30 | 3b 0d 09 09 09 09 09 44 |sk) == 0|;......D|
|000028b0| 6f 41 63 74 69 76 61 74 | 65 28 46 72 6f 6e 74 57 |oActivat|e(FrontW|
|000028c0| 69 6e 64 6f 77 28 29 2c | 20 21 67 49 6e 42 61 63 |indow(),| !gInBac|
|000028d0| 6b 67 72 6f 75 6e 64 29 | 3b 0d 09 09 09 09 09 62 |kground)|;......b|
|000028e0| 72 65 61 6b 3b 0d 09 09 | 09 7d 0d 09 09 09 62 72 |reak;...|.}....br|
|000028f0| 65 61 6b 3b 0d 09 7d 0d | 7d 20 2f 2a 44 6f 45 76 |eak;..}.|} /*DoEv|
|00002900| 65 6e 74 2a 2f 0d 0d 0d | 2f 2a 09 43 68 61 6e 67 |ent*/...|/*.Chang|
|00002910| 65 20 74 68 65 20 63 75 | 72 73 6f 72 27 73 20 73 |e the cu|rsor's s|
|00002920| 68 61 70 65 2c 20 64 65 | 70 65 6e 64 69 6e 67 20 |hape, de|pending |
|00002930| 6f 6e 20 69 74 73 20 70 | 6f 73 69 74 69 6f 6e 2e |on its p|osition.|
|00002940| 20 54 68 69 73 20 61 6c | 73 6f 20 63 61 6c 63 75 | This al|so calcu|
|00002950| 6c 61 74 65 73 20 74 68 | 65 20 72 65 67 69 6f 6e |lates th|e region|
|00002960| 0d 09 77 68 65 72 65 20 | 74 68 65 20 63 75 72 72 |..where |the curr|
|00002970| 65 6e 74 20 63 75 72 73 | 6f 72 20 72 65 73 69 64 |ent curs|or resid|
|00002980| 65 73 20 28 66 6f 72 20 | 57 61 69 74 4e 65 78 74 |es (for |WaitNext|
|00002990| 45 76 65 6e 74 29 2e 20 | 49 66 20 74 68 65 20 6d |Event). |If the m|
|000029a0| 6f 75 73 65 20 69 73 20 | 65 76 65 72 20 6f 75 74 |ouse is |ever out|
|000029b0| 73 69 64 65 20 6f 66 0d | 09 74 68 61 74 20 72 65 |side of.|.that re|
|000029c0| 67 69 6f 6e 2c 20 61 6e | 20 65 76 65 6e 74 20 77 |gion, an| event w|
|000029d0| 6f 75 6c 64 20 62 65 20 | 67 65 6e 65 72 61 74 65 |ould be |generate|
|000029e0| 64 2c 20 63 61 75 73 69 | 6e 67 20 74 68 69 73 20 |d, causi|ng this |
|000029f0| 72 6f 75 74 69 6e 65 20 | 74 6f 20 62 65 20 63 61 |routine |to be ca|
|00002a00| 6c 6c 65 64 2c 0d 09 61 | 6c 6c 6f 77 69 6e 67 20 |lled,..a|llowing |
|00002a10| 75 73 20 74 6f 20 63 68 | 61 6e 67 65 20 74 68 65 |us to ch|ange the|
|00002a20| 20 72 65 67 69 6f 6e 20 | 74 6f 20 74 68 65 20 72 | region |to the r|
|00002a30| 65 67 69 6f 6e 20 74 68 | 65 20 6d 6f 75 73 65 20 |egion th|e mouse |
|00002a40| 69 73 20 63 75 72 72 65 | 6e 74 6c 79 20 69 6e 2e |is curre|ntly in.|
|00002a50| 20 49 66 0d 09 74 68 65 | 72 65 20 69 73 20 6d 6f | If..the|re is mo|
|00002a60| 72 65 20 74 6f 20 74 68 | 65 20 65 76 65 6e 74 20 |re to th|e event |
|00002a70| 74 68 61 6e 20 6a 75 73 | 74 20 d2 74 68 65 20 6d |than jus|t .the m|
|00002a80| 6f 75 73 65 20 6d 6f 76 | 65 64 d3 2c 20 77 65 20 |ouse mov|ed., we |
|00002a90| 67 65 74 20 63 61 6c 6c | 65 64 20 62 65 66 6f 72 |get call|ed befor|
|00002aa0| 65 20 74 68 65 0d 09 65 | 76 65 6e 74 20 69 73 20 |e the..e|vent is |
|00002ab0| 70 72 6f 63 65 73 73 65 | 64 20 74 6f 20 6d 61 6b |processe|d to mak|
|00002ac0| 65 20 73 75 72 65 20 74 | 68 65 20 63 75 72 73 6f |e sure t|he curso|
|00002ad0| 72 20 69 73 20 74 68 65 | 20 72 69 67 68 74 20 6f |r is the| right o|
|00002ae0| 6e 65 2e 20 49 6e 20 61 | 6e 79 20 28 61 68 65 6d |ne. In a|ny (ahem|
|00002af0| 29 20 65 76 65 6e 74 2c | 0d 09 74 68 69 73 20 69 |) event,|..this i|
|00002b00| 73 20 63 61 6c 6c 65 64 | 20 61 67 61 69 6e 20 62 |s called| again b|
|00002b10| 65 66 6f 72 65 20 77 65 | 20 09 66 61 6c 6c 20 62 |efore we| .fall b|
|00002b20| 61 63 6b 20 69 6e 74 6f | 20 57 4e 45 2e 20 2a 2f |ack into| WNE. */|
|00002b30| 0d 0d 23 70 72 61 67 6d | 61 20 73 65 67 6d 65 6e |..#pragm|a segmen|
|00002b40| 74 20 4d 61 69 6e 0d 76 | 6f 69 64 20 41 64 6a 75 |t Main.v|oid Adju|
|00002b50| 73 74 43 75 72 73 6f 72 | 28 6d 6f 75 73 65 2c 72 |stCursor|(mouse,r|
|00002b60| 65 67 69 6f 6e 29 0d 09 | 50 6f 69 6e 74 09 09 6d |egion)..|Point..m|
|00002b70| 6f 75 73 65 3b 0d 09 52 | 67 6e 48 61 6e 64 6c 65 |ouse;..R|gnHandle|
|00002b80| 09 72 65 67 69 6f 6e 3b | 0d 7b 0d 09 57 69 6e 64 |.region;|.{..Wind|
|00002b90| 6f 77 50 74 72 09 77 69 | 6e 64 6f 77 3b 0d 09 52 |owPtr.wi|ndow;..R|
|00002ba0| 67 6e 48 61 6e 64 6c 65 | 09 61 72 72 6f 77 52 67 |gnHandle|.arrowRg|
|00002bb0| 6e 3b 0d 09 52 67 6e 48 | 61 6e 64 6c 65 09 70 6c |n;..RgnH|andle.pl|
|00002bc0| 75 73 52 67 6e 3b 0d 09 | 52 65 63 74 09 09 67 6c |usRgn;..|Rect..gl|
|00002bd0| 6f 62 61 6c 50 6f 72 74 | 52 65 63 74 3b 0d 0d 09 |obalPort|Rect;...|
|00002be0| 77 69 6e 64 6f 77 20 3d | 20 46 72 6f 6e 74 57 69 |window =| FrontWi|
|00002bf0| 6e 64 6f 77 28 29 3b 09 | 2f 2a 20 77 65 20 6f 6e |ndow();.|/* we on|
|00002c00| 6c 79 20 61 64 6a 75 73 | 74 20 74 68 65 20 63 75 |ly adjus|t the cu|
|00002c10| 72 73 6f 72 20 77 68 65 | 6e 20 77 65 20 61 72 65 |rsor whe|n we are|
|00002c20| 20 69 6e 20 66 72 6f 6e | 74 20 2a 2f 0d 09 69 66 | in fron|t */..if|
|00002c30| 20 28 20 28 21 20 67 49 | 6e 42 61 63 6b 67 72 6f | ( (! gI|nBackgro|
|00002c40| 75 6e 64 29 20 26 26 20 | 28 21 20 49 73 44 41 57 |und) && |(! IsDAW|
|00002c50| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 29 20 29 |indow(wi|ndow)) )|
|00002c60| 20 7b 0d 09 09 2f 2a 20 | 63 61 6c 63 75 6c 61 74 | {.../* |calculat|
|00002c70| 65 20 72 65 67 69 6f 6e | 73 20 66 6f 72 20 64 69 |e region|s for di|
|00002c80| 66 66 65 72 65 6e 74 20 | 63 75 72 73 6f 72 20 73 |fferent |cursor s|
|00002c90| 68 61 70 65 73 20 2a 2f | 0d 09 09 61 72 72 6f 77 |hapes */|...arrow|
|00002ca0| 52 67 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 0d |Rgn = Ne|wRgn();.|
|00002cb0| 09 09 70 6c 75 73 52 67 | 6e 20 3d 20 4e 65 77 52 |..plusRg|n = NewR|
|00002cc0| 67 6e 28 29 3b 0d 0d 09 | 09 2f 2a 20 73 74 61 72 |gn();...|./* star|
|00002cd0| 74 20 77 69 74 68 20 61 | 20 62 69 67 2c 20 62 69 |t with a| big, bi|
|00002ce0| 67 20 72 65 63 74 61 6e | 67 75 6c 61 72 20 72 65 |g rectan|gular re|
|00002cf0| 67 69 6f 6e 20 2a 2f 0d | 09 09 53 65 74 52 65 63 |gion */.|..SetRec|
|00002d00| 74 52 67 6e 28 61 72 72 | 6f 77 52 67 6e 2c 20 6b |tRgn(arr|owRgn, k|
|00002d10| 45 78 74 72 65 6d 65 4e | 65 67 2c 20 6b 45 78 74 |ExtremeN|eg, kExt|
|00002d20| 72 65 6d 65 4e 65 67 2c | 20 6b 45 78 74 72 65 6d |remeNeg,| kExtrem|
|00002d30| 65 50 6f 73 2c 20 6b 45 | 78 74 72 65 6d 65 50 6f |ePos, kE|xtremePo|
|00002d40| 73 29 3b 0d 0d 09 09 2f | 2a 20 63 61 6c 63 75 6c |s);..../|* calcul|
|00002d50| 61 74 65 20 70 6c 75 73 | 52 67 6e 20 2a 2f 0d 09 |ate plus|Rgn */..|
|00002d60| 09 69 66 20 28 20 49 73 | 41 70 70 57 69 6e 64 6f |.if ( Is|AppWindo|
|00002d70| 77 28 77 69 6e 64 6f 77 | 29 20 29 20 7b 0d 09 09 |w(window|) ) {...|
|00002d80| 09 53 65 74 50 6f 72 74 | 28 77 69 6e 64 6f 77 29 |.SetPort|(window)|
|00002d90| 3b 09 2f 2a 20 6d 61 6b | 65 20 61 20 67 6c 6f 62 |;./* mak|e a glob|
|00002da0| 61 6c 20 76 65 72 73 69 | 6f 6e 20 6f 66 20 74 68 |al versi|on of th|
|00002db0| 65 20 76 69 65 77 52 65 | 63 74 20 2a 2f 0d 09 09 |e viewRe|ct */...|
|00002dc0| 09 53 65 74 4f 72 69 67 | 69 6e 28 2d 77 69 6e 64 |.SetOrig|in(-wind|
|00002dd0| 6f 77 2d 3e 70 6f 72 74 | 42 69 74 73 2e 62 6f 75 |ow->port|Bits.bou|
|00002de0| 6e 64 73 2e 6c 65 66 74 | 2c 20 2d 77 69 6e 64 6f |nds.left|, -windo|
|00002df0| 77 2d 3e 70 6f 72 74 42 | 69 74 73 2e 62 6f 75 6e |w->portB|its.boun|
|00002e00| 64 73 2e 74 6f 70 29 3b | 0d 09 09 09 67 6c 6f 62 |ds.top);|....glob|
|00002e10| 61 6c 50 6f 72 74 52 65 | 63 74 20 3d 20 77 69 6e |alPortRe|ct = win|
|00002e20| 64 6f 77 2d 3e 70 6f 72 | 74 52 65 63 74 3b 0d 09 |dow->por|tRect;..|
|00002e30| 09 09 52 65 63 74 52 67 | 6e 28 70 6c 75 73 52 67 |..RectRg|n(plusRg|
|00002e40| 6e 2c 20 26 67 6c 6f 62 | 61 6c 50 6f 72 74 52 65 |n, &glob|alPortRe|
|00002e50| 63 74 29 3b 0d 09 09 09 | 53 65 63 74 52 67 6e 28 |ct);....|SectRgn(|
|00002e60| 70 6c 75 73 52 67 6e 2c | 20 77 69 6e 64 6f 77 2d |plusRgn,| window-|
|00002e70| 3e 76 69 73 52 67 6e 2c | 20 70 6c 75 73 52 67 6e |>visRgn,| plusRgn|
|00002e80| 29 3b 0d 09 09 09 53 65 | 74 4f 72 69 67 69 6e 28 |);....Se|tOrigin(|
|00002e90| 30 2c 20 30 29 3b 0d 09 | 09 7d 0d 0d 09 09 2f 2a |0, 0);..|.}..../*|
|00002ea0| 20 73 75 62 74 72 61 63 | 74 20 6f 74 68 65 72 20 | subtrac|t other |
|00002eb0| 72 65 67 69 6f 6e 73 20 | 66 72 6f 6d 20 61 72 72 |regions |from arr|
|00002ec0| 6f 77 52 67 6e 20 2a 2f | 0d 09 09 44 69 66 66 52 |owRgn */|...DiffR|
|00002ed0| 67 6e 28 61 72 72 6f 77 | 52 67 6e 2c 20 70 6c 75 |gn(arrow|Rgn, plu|
|00002ee0| 73 52 67 6e 2c 20 61 72 | 72 6f 77 52 67 6e 29 3b |sRgn, ar|rowRgn);|
|00002ef0| 0d 0d 09 09 2f 2a 20 63 | 68 61 6e 67 65 20 74 68 |..../* c|hange th|
|00002f00| 65 20 63 75 72 73 6f 72 | 20 61 6e 64 20 74 68 65 |e cursor| and the|
|00002f10| 20 72 65 67 69 6f 6e 20 | 70 61 72 61 6d 65 74 65 | region |paramete|
|00002f20| 72 20 2a 2f 0d 09 09 69 | 66 20 28 20 50 74 49 6e |r */...i|f ( PtIn|
|00002f30| 52 67 6e 28 6d 6f 75 73 | 65 2c 20 70 6c 75 73 52 |Rgn(mous|e, plusR|
|00002f40| 67 6e 29 20 29 20 7b 0d | 09 09 09 53 65 74 43 75 |gn) ) {.|...SetCu|
|00002f50| 72 73 6f 72 28 2a 47 65 | 74 43 75 72 73 6f 72 28 |rsor(*Ge|tCursor(|
|00002f60| 70 6c 75 73 43 75 72 73 | 6f 72 29 29 3b 0d 09 09 |plusCurs|or));...|
|00002f70| 09 43 6f 70 79 52 67 6e | 28 70 6c 75 73 52 67 6e |.CopyRgn|(plusRgn|
|00002f80| 2c 20 72 65 67 69 6f 6e | 29 3b 0d 09 09 7d 20 65 |, region|);...} e|
|00002f90| 6c 73 65 20 7b 0d 09 09 | 09 53 65 74 43 75 72 73 |lse {...|.SetCurs|
|00002fa0| 6f 72 28 26 71 64 2e 61 | 72 72 6f 77 29 3b 0d 09 |or(&qd.a|rrow);..|
|00002fb0| 09 09 43 6f 70 79 52 67 | 6e 28 61 72 72 6f 77 52 |..CopyRg|n(arrowR|
|00002fc0| 67 6e 2c 20 72 65 67 69 | 6f 6e 29 3b 0d 09 09 7d |gn, regi|on);...}|
|00002fd0| 0d 0d 09 09 2f 2a 20 67 | 65 74 20 72 69 64 20 6f |..../* g|et rid o|
|00002fe0| 66 20 6f 75 72 20 6c 6f | 63 61 6c 20 72 65 67 69 |f our lo|cal regi|
|00002ff0| 6f 6e 73 20 2a 2f 0d 09 | 09 44 69 73 70 6f 73 65 |ons */..|.Dispose|
|00003000| 52 67 6e 28 61 72 72 6f | 77 52 67 6e 29 3b 0d 09 |Rgn(arro|wRgn);..|
|00003010| 09 44 69 73 70 6f 73 65 | 52 67 6e 28 70 6c 75 73 |.Dispose|Rgn(plus|
|00003020| 52 67 6e 29 3b 0d 09 7d | 0d 7d 20 2f 2a 41 64 6a |Rgn);..}|.} /*Adj|
|00003030| 75 73 74 43 75 72 73 6f | 72 2a 2f 0d 0d 0d 2f 2a |ustCurso|r*/.../*|
|00003040| 09 47 65 74 20 74 68 65 | 20 67 6c 6f 62 61 6c 20 |.Get the| global |
|00003050| 63 6f 6f 72 64 69 6e 61 | 74 65 73 20 6f 66 20 74 |coordina|tes of t|
|00003060| 68 65 20 6d 6f 75 73 65 | 2e 20 57 68 65 6e 20 79 |he mouse|. When y|
|00003070| 6f 75 20 63 61 6c 6c 20 | 4f 53 45 76 65 6e 74 41 |ou call |OSEventA|
|00003080| 76 61 69 6c 0d 09 69 74 | 20 77 69 6c 6c 20 72 65 |vail..it| will re|
|00003090| 74 75 72 6e 20 65 69 74 | 68 65 72 20 61 20 70 65 |turn eit|her a pe|
|000030a0| 6e 64 69 6e 67 20 65 76 | 65 6e 74 20 6f 72 20 61 |nding ev|ent or a|
|000030b0| 20 6e 75 6c 6c 20 65 76 | 65 6e 74 2e 20 49 6e 20 | null ev|ent. In |
|000030c0| 65 69 74 68 65 72 20 63 | 61 73 65 2c 0d 09 74 68 |either c|ase,..th|
|000030d0| 65 20 77 68 65 72 65 20 | 66 69 65 6c 64 20 6f 66 |e where |field of|
|000030e0| 20 74 68 65 20 65 76 65 | 6e 74 20 72 65 63 6f 72 | the eve|nt recor|
|000030f0| 64 20 77 69 6c 6c 20 63 | 6f 6e 74 61 69 6e 20 74 |d will c|ontain t|
|00003100| 68 65 20 63 75 72 72 65 | 6e 74 20 70 6f 73 69 74 |he curre|nt posit|
|00003110| 69 6f 6e 0d 09 6f 66 20 | 74 68 65 20 6d 6f 75 73 |ion..of |the mous|
|00003120| 65 20 69 6e 20 67 6c 6f | 62 61 6c 20 63 6f 6f 72 |e in glo|bal coor|
|00003130| 64 69 6e 61 74 65 73 20 | 61 6e 64 20 74 68 65 20 |dinates |and the |
|00003140| 6d 6f 64 69 66 69 65 72 | 73 20 66 69 65 6c 64 20 |modifier|s field |
|00003150| 77 69 6c 6c 20 72 65 66 | 6c 65 63 74 0d 09 74 68 |will ref|lect..th|
|00003160| 65 20 63 75 72 72 65 6e | 74 20 73 74 61 74 65 20 |e curren|t state |
|00003170| 6f 66 20 74 68 65 20 6d | 6f 64 69 66 69 65 72 73 |of the m|odifiers|
|00003180| 2e 20 41 6e 6f 74 68 65 | 72 20 77 61 79 20 74 6f |. Anothe|r way to|
|00003190| 20 67 65 74 20 74 68 65 | 20 67 6c 6f 62 61 6c 0d | get the| global.|
|000031a0| 09 63 6f 6f 72 64 69 6e | 61 74 65 73 20 69 73 20 |.coordin|ates is |
|000031b0| 74 6f 20 63 61 6c 6c 20 | 47 65 74 4d 6f 75 73 65 |to call |GetMouse|
|000031c0| 20 61 6e 64 20 4c 6f 63 | 61 6c 54 6f 47 6c 6f 62 | and Loc|alToGlob|
|000031d0| 61 6c 2c 20 62 75 74 20 | 74 68 61 74 20 72 65 71 |al, but |that req|
|000031e0| 75 69 72 65 73 0d 09 62 | 65 69 6e 67 20 73 75 72 |uires..b|eing sur|
|000031f0| 65 20 74 68 61 74 20 74 | 68 65 50 6f 72 74 20 69 |e that t|hePort i|
|00003200| 73 20 73 65 74 20 74 6f | 20 61 20 76 61 6c 69 64 |s set to| a valid|
|00003210| 20 70 6f 72 74 2e 20 2a | 2f 0d 0d 23 70 72 61 67 | port. *|/..#prag|
|00003220| 6d 61 20 73 65 67 6d 65 | 6e 74 20 4d 61 69 6e 0d |ma segme|nt Main.|
|00003230| 76 6f 69 64 20 47 65 74 | 47 6c 6f 62 61 6c 4d 6f |void Get|GlobalMo|
|00003240| 75 73 65 28 6d 6f 75 73 | 65 29 0d 09 50 6f 69 6e |use(mous|e)..Poin|
|00003250| 74 09 2a 6d 6f 75 73 65 | 3b 0d 7b 0d 09 45 76 65 |t.*mouse|;.{..Eve|
|00003260| 6e 74 52 65 63 6f 72 64 | 09 65 76 65 6e 74 3b 0d |ntRecord|.event;.|
|00003270| 09 0d 09 4f 53 45 76 65 | 6e 74 41 76 61 69 6c 28 |...OSEve|ntAvail(|
|00003280| 6b 4e 6f 45 76 65 6e 74 | 73 2c 20 26 65 76 65 6e |kNoEvent|s, &even|
|00003290| 74 29 3b 09 2f 2a 20 77 | 65 20 61 72 65 6e 27 74 |t);./* w|e aren't|
|000032a0| 20 69 6e 74 65 72 65 73 | 74 65 64 20 69 6e 20 61 | interes|ted in a|
|000032b0| 6e 79 20 65 76 65 6e 74 | 73 20 2a 2f 0d 09 2a 6d |ny event|s */..*m|
|000032c0| 6f 75 73 65 20 3d 20 65 | 76 65 6e 74 2e 77 68 65 |ouse = e|vent.whe|
|000032d0| 72 65 3b 09 09 09 09 2f | 2a 20 6a 75 73 74 20 74 |re;..../|* just t|
|000032e0| 68 65 20 6d 6f 75 73 65 | 20 70 6f 73 69 74 69 6f |he mouse| positio|
|000032f0| 6e 20 2a 2f 0d 7d 20 2f | 2a 47 65 74 47 6c 6f 62 |n */.} /|*GetGlob|
|00003300| 61 6c 4d 6f 75 73 65 2a | 2f 0d 0d 0d 2f 2a 09 54 |alMouse*|/.../*.T|
|00003310| 68 69 73 20 69 73 20 63 | 61 6c 6c 65 64 20 77 68 |his is c|alled wh|
|00003320| 65 6e 20 61 6e 20 75 70 | 64 61 74 65 20 65 76 65 |en an up|date eve|
|00003330| 6e 74 20 69 73 20 72 65 | 63 65 69 76 65 64 20 66 |nt is re|ceived f|
|00003340| 6f 72 20 61 20 77 69 6e | 64 6f 77 2e 0d 09 49 74 |or a win|dow...It|
|00003350| 20 63 61 6c 6c 73 20 44 | 72 61 77 57 69 6e 64 6f | calls D|rawWindo|
|00003360| 77 20 74 6f 20 64 72 61 | 77 20 74 68 65 20 63 6f |w to dra|w the co|
|00003370| 6e 74 65 6e 74 73 20 6f | 66 20 61 6e 20 61 70 70 |ntents o|f an app|
|00003380| 6c 69 63 61 74 69 6f 6e | 20 77 69 6e 64 6f 77 2e |lication| window.|
|00003390| 0d 09 41 73 20 61 6e 20 | 65 66 66 65 63 69 65 6e |..As an |effecien|
|000033a0| 63 79 20 6d 65 61 73 75 | 72 65 20 74 68 61 74 20 |cy measu|re that |
|000033b0| 64 6f 65 73 20 6e 6f 74 | 20 68 61 76 65 20 74 6f |does not| have to|
|000033c0| 20 62 65 20 66 6f 6c 6c | 6f 77 65 64 2c 20 69 74 | be foll|owed, it|
|000033d0| 0d 09 63 61 6c 6c 73 20 | 74 68 65 20 64 72 61 77 |..calls |the draw|
|000033e0| 69 6e 67 20 72 6f 75 74 | 69 6e 65 20 6f 6e 6c 79 |ing rout|ine only|
|000033f0| 20 69 66 20 74 68 65 20 | 76 69 73 52 67 6e 20 69 | if the |visRgn i|
|00003400| 73 20 6e 6f 6e 2d 65 6d | 70 74 79 2e 20 54 68 69 |s non-em|pty. Thi|
|00003410| 73 0d 09 77 69 6c 6c 20 | 68 61 6e 64 6c 65 20 73 |s..will |handle s|
|00003420| 69 74 75 61 74 69 6f 6e | 73 20 77 68 65 72 65 20 |ituation|s where |
|00003430| 63 61 6c 63 75 6c 61 74 | 69 6f 6e 73 20 66 6f 72 |calculat|ions for|
|00003440| 20 64 72 61 77 69 6e 67 | 20 6f 72 20 64 72 61 77 | drawing| or draw|
|00003450| 69 6e 67 0d 09 69 74 73 | 65 6c 66 20 69 73 20 76 |ing..its|elf is v|
|00003460| 65 72 79 20 74 69 6d 65 | 2d 63 6f 6e 73 75 6d 69 |ery time|-consumi|
|00003470| 6e 67 2e 20 2a 2f 0d 0d | 23 70 72 61 67 6d 61 20 |ng. */..|#pragma |
|00003480| 73 65 67 6d 65 6e 74 20 | 4d 61 69 6e 0d 76 6f 69 |segment |Main.voi|
|00003490| 64 20 44 6f 55 70 64 61 | 74 65 28 77 69 6e 64 6f |d DoUpda|te(windo|
|000034a0| 77 29 0d 09 57 69 6e 64 | 6f 77 50 74 72 09 77 69 |w)..Wind|owPtr.wi|
|000034b0| 6e 64 6f 77 3b 0d 7b 0d | 09 69 66 20 28 20 49 73 |ndow;.{.|.if ( Is|
|000034c0| 41 70 70 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |AppWindo|w(window|
|000034d0| 29 20 29 20 7b 0d 09 09 | 42 65 67 69 6e 55 70 64 |) ) {...|BeginUpd|
|000034e0| 61 74 65 28 77 69 6e 64 | 6f 77 29 3b 09 09 09 09 |ate(wind|ow);....|
|000034f0| 2f 2a 20 74 68 69 73 20 | 73 65 74 73 20 75 70 20 |/* this |sets up |
|00003500| 74 68 65 20 76 69 73 52 | 67 6e 20 2a 2f 0d 09 09 |the visR|gn */...|
|00003510| 69 66 20 28 20 21 20 45 | 6d 70 74 79 52 67 6e 28 |if ( ! E|mptyRgn(|
|00003520| 77 69 6e 64 6f 77 2d 3e | 76 69 73 52 67 6e 29 20 |window->|visRgn) |
|00003530| 29 09 2f 2a 20 64 72 61 | 77 20 69 66 20 75 70 64 |)./* dra|w if upd|
|00003540| 61 74 69 6e 67 20 6e 65 | 65 64 73 20 74 6f 20 62 |ating ne|eds to b|
|00003550| 65 20 64 6f 6e 65 20 2a | 2f 0d 09 09 09 44 72 61 |e done *|/....Dra|
|00003560| 77 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 29 3b |wWindow(|window);|
|00003570| 0d 09 09 45 6e 64 55 70 | 64 61 74 65 28 77 69 6e |...EndUp|date(win|
|00003580| 64 6f 77 29 3b 0d 09 7d | 0d 7d 20 2f 2a 44 6f 55 |dow);..}|.} /*DoU|
|00003590| 70 64 61 74 65 2a 2f 0d | 0d 0d 2f 2a 09 54 68 69 |pdate*/.|../*.Thi|
|000035a0| 73 20 69 73 20 63 61 6c | 6c 65 64 20 77 68 65 6e |s is cal|led when|
|000035b0| 20 61 20 77 69 6e 64 6f | 77 20 69 73 20 61 63 74 | a windo|w is act|
|000035c0| 69 76 61 74 65 64 20 6f | 72 20 64 65 61 63 74 69 |ivated o|r deacti|
|000035d0| 76 61 74 65 64 2e 0d 09 | 49 6e 20 53 61 6d 70 6c |vated...|In Sampl|
|000035e0| 65 2c 20 74 68 65 20 57 | 69 6e 64 6f 77 20 4d 61 |e, the W|indow Ma|
|000035f0| 6e 61 67 65 72 27 73 20 | 68 61 6e 64 6c 69 6e 67 |nager's |handling|
|00003600| 20 6f 66 20 61 63 74 69 | 76 61 74 65 20 61 6e 64 | of acti|vate and|
|00003610| 0d 09 64 65 61 63 74 69 | 76 61 74 65 20 65 76 65 |..deacti|vate eve|
|00003620| 6e 74 73 20 69 73 20 73 | 75 66 66 69 63 69 65 6e |nts is s|ufficien|
|00003630| 74 2e 20 4f 74 68 65 72 | 20 61 70 70 6c 69 63 61 |t. Other| applica|
|00003640| 74 69 6f 6e 73 20 6d 61 | 79 20 68 61 76 65 0d 09 |tions ma|y have..|
|00003650| 54 65 78 74 45 64 69 74 | 20 72 65 63 6f 72 64 73 |TextEdit| records|
|00003660| 2c 20 63 6f 6e 74 72 6f | 6c 73 2c 20 6c 69 73 74 |, contro|ls, list|
|00003670| 73 2c 20 65 74 63 2e 2c | 20 74 6f 20 61 63 74 69 |s, etc.,| to acti|
|00003680| 76 61 74 65 2f 64 65 61 | 63 74 69 76 61 74 65 2e |vate/dea|ctivate.|
|00003690| 20 2a 2f 0d 0d 23 70 72 | 61 67 6d 61 20 73 65 67 | */..#pr|agma seg|
|000036a0| 6d 65 6e 74 20 4d 61 69 | 6e 0d 76 6f 69 64 20 44 |ment Mai|n.void D|
|000036b0| 6f 41 63 74 69 76 61 74 | 65 28 77 69 6e 64 6f 77 |oActivat|e(window|
|000036c0| 2c 20 62 65 63 6f 6d 69 | 6e 67 41 63 74 69 76 65 |, becomi|ngActive|
|000036d0| 29 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |)..Windo|wPtr.win|
|000036e0| 64 6f 77 3b 0d 09 42 6f | 6f 6c 65 61 6e 09 09 62 |dow;..Bo|olean..b|
|000036f0| 65 63 6f 6d 69 6e 67 41 | 63 74 69 76 65 3b 0d 7b |ecomingA|ctive;.{|
|00003700| 0d 09 69 66 20 28 20 49 | 73 41 70 70 57 69 6e 64 |..if ( I|sAppWind|
|00003710| 6f 77 28 77 69 6e 64 6f | 77 29 20 29 20 7b 0d 09 |ow(windo|w) ) {..|
|00003720| 09 69 66 20 28 20 62 65 | 63 6f 6d 69 6e 67 41 63 |.if ( be|comingAc|
|00003730| 74 69 76 65 20 29 0d 09 | 09 09 2f 2a 20 64 6f 20 |tive )..|../* do |
|00003740| 77 68 61 74 65 76 65 72 | 20 79 6f 75 20 6e 65 65 |whatever| you nee|
|00003750| 64 20 74 6f 20 61 74 20 | 61 63 74 69 76 61 74 69 |d to at |activati|
|00003760| 6f 6e 20 2a 2f 20 3b 0d | 09 09 65 6c 73 65 0d 09 |on */ ;.|..else..|
|00003770| 09 09 2f 2a 20 64 6f 20 | 77 68 61 74 65 76 65 72 |../* do |whatever|
|00003780| 20 79 6f 75 20 6e 65 65 | 64 20 74 6f 20 61 74 20 | you nee|d to at |
|00003790| 64 65 61 63 74 69 76 61 | 74 69 6f 6e 20 2a 2f 20 |deactiva|tion */ |
|000037a0| 3b 0d 09 7d 0d 7d 20 2f | 2a 44 6f 41 63 74 69 76 |;..}.} /|*DoActiv|
|000037b0| 61 74 65 2a 2f 0d 0d 0d | 2f 2a 09 54 68 69 73 20 |ate*/...|/*.This |
|000037c0| 69 73 20 63 61 6c 6c 65 | 64 20 77 68 65 6e 20 61 |is calle|d when a|
|000037d0| 20 6d 6f 75 73 65 2d 64 | 6f 77 6e 20 65 76 65 6e | mouse-d|own even|
|000037e0| 74 20 6f 63 63 75 72 73 | 20 69 6e 20 74 68 65 20 |t occurs| in the |
|000037f0| 63 6f 6e 74 65 6e 74 20 | 6f 66 20 61 20 77 69 6e |content |of a win|
|00003800| 64 6f 77 2e 0d 09 4f 74 | 68 65 72 20 61 70 70 6c |dow...Ot|her appl|
|00003810| 69 63 61 74 69 6f 6e 73 | 20 6d 69 67 68 74 20 77 |ications| might w|
|00003820| 61 6e 74 20 74 6f 20 63 | 61 6c 6c 20 46 69 6e 64 |ant to c|all Find|
|00003830| 43 6f 6e 74 72 6f 6c 2c | 20 54 45 43 6c 69 63 6b |Control,| TEClick|
|00003840| 2c 20 65 74 63 2e 2c 20 | 74 6f 0d 09 66 75 72 74 |, etc., |to..furt|
|00003850| 68 65 72 20 70 72 6f 63 | 65 73 73 20 74 68 65 20 |her proc|ess the |
|00003860| 63 6c 69 63 6b 2e 20 2a | 2f 0d 0d 23 70 72 61 67 |click. *|/..#prag|
|00003870| 6d 61 20 73 65 67 6d 65 | 6e 74 20 4d 61 69 6e 0d |ma segme|nt Main.|
|00003880| 76 6f 69 64 20 44 6f 43 | 6f 6e 74 65 6e 74 43 6c |void DoC|ontentCl|
|00003890| 69 63 6b 28 77 69 6e 64 | 6f 77 29 0d 09 57 69 6e |ick(wind|ow)..Win|
|000038a0| 64 6f 77 50 74 72 09 77 | 69 6e 64 6f 77 3b 0d 7b |dowPtr.w|indow;.{|
|000038b0| 0d 09 53 65 74 4c 69 67 | 68 74 28 77 69 6e 64 6f |..SetLig|ht(windo|
|000038c0| 77 2c 20 21 20 67 53 74 | 6f 70 70 65 64 29 3b 0d |w, ! gSt|opped);.|
|000038d0| 7d 20 2f 2a 44 6f 43 6f | 6e 74 65 6e 74 43 6c 69 |} /*DoCo|ntentCli|
|000038e0| 63 6b 2a 2f 0d 0d 0d 2f | 2a 20 44 72 61 77 20 74 |ck*/.../|* Draw t|
|000038f0| 68 65 20 63 6f 6e 74 65 | 6e 74 73 20 6f 66 20 74 |he conte|nts of t|
|00003900| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 77 |he appli|cation w|
|00003910| 69 6e 64 6f 77 2e 20 57 | 65 20 64 6f 20 73 6f 6d |indow. W|e do som|
|00003920| 65 20 64 72 61 77 69 6e | 67 20 69 6e 20 63 6f 6c |e drawin|g in col|
|00003930| 6f 72 2c 20 75 73 69 6e | 67 0d 20 20 20 43 6c 61 |or, usin|g. Cla|
|00003940| 73 73 69 63 20 51 75 69 | 63 6b 44 72 61 77 27 73 |ssic Qui|ckDraw's|
|00003950| 20 63 6f 6c 6f 72 20 63 | 61 70 61 62 69 6c 69 74 | color c|apabilit|
|00003960| 69 65 73 2e 20 54 68 69 | 73 20 77 69 6c 6c 20 62 |ies. Thi|s will b|
|00003970| 65 20 62 6c 61 63 6b 20 | 61 6e 64 20 77 68 69 74 |e black |and whit|
|00003980| 65 20 6f 6e 20 6f 6c 64 | 0d 20 20 20 6d 61 63 68 |e on old|. mach|
|00003990| 69 6e 65 73 2c 20 62 75 | 74 20 63 6f 6c 6f 72 20 |ines, bu|t color |
|000039a0| 6f 6e 20 63 6f 6c 6f 72 | 20 6d 61 63 68 69 6e 65 |on color| machine|
|000039b0| 73 2e 20 41 74 20 74 68 | 69 73 20 70 6f 69 6e 74 |s. At th|is point|
|000039c0| 2c 20 74 68 65 20 77 69 | 6e 64 6f 77 d5 73 20 76 |, the wi|ndow.s v|
|000039d0| 69 73 52 67 6e 0d 20 20 | 20 69 73 20 73 65 74 20 |isRgn. | is set |
|000039e0| 74 6f 20 61 6c 6c 6f 77 | 20 64 72 61 77 69 6e 67 |to allow| drawing|
|000039f0| 20 6f 6e 6c 79 20 77 68 | 65 72 65 20 69 74 20 6e | only wh|ere it n|
|00003a00| 65 65 64 73 20 74 6f 20 | 62 65 20 64 6f 6e 65 2e |eeds to |be done.|
|00003a10| 20 2a 2f 0d 0d 23 70 72 | 61 67 6d 61 20 73 65 67 | */..#pr|agma seg|
|00003a20| 6d 65 6e 74 20 4d 61 69 | 6e 0d 76 6f 69 64 20 44 |ment Mai|n.void D|
|00003a30| 72 61 77 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |rawWindo|w(window|
|00003a40| 29 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |)..Windo|wPtr.win|
|00003a50| 64 6f 77 3b 0d 7b 0d 09 | 53 65 74 50 6f 72 74 28 |dow;.{..|SetPort(|
|00003a60| 77 69 6e 64 6f 77 29 3b | 0d 0d 09 45 72 61 73 65 |window);|...Erase|
|00003a70| 52 65 63 74 28 26 77 69 | 6e 64 6f 77 2d 3e 70 6f |Rect(&wi|ndow->po|
|00003a80| 72 74 52 65 63 74 29 3b | 09 2f 2a 20 63 6c 65 61 |rtRect);|./* clea|
|00003a90| 72 20 6f 75 74 20 61 6e | 79 20 67 61 72 62 61 67 |r out an|y garbag|
|00003aa0| 65 20 74 68 61 74 20 6d | 61 79 20 6c 69 6e 67 65 |e that m|ay linge|
|00003ab0| 72 20 2a 2f 0d 09 69 66 | 20 28 20 67 53 74 6f 70 |r */..if| ( gStop|
|00003ac0| 70 65 64 20 29 09 09 09 | 09 09 2f 2a 20 64 72 61 |ped )...|../* dra|
|00003ad0| 77 20 61 20 72 65 64 20 | 28 6f 72 20 77 68 69 74 |w a red |(or whit|
|00003ae0| 65 29 20 73 74 6f 70 20 | 6c 69 67 68 74 20 2a 2f |e) stop |light */|
|00003af0| 0d 09 09 46 6f 72 65 43 | 6f 6c 6f 72 28 72 65 64 |...ForeC|olor(red|
|00003b00| 43 6f 6c 6f 72 29 3b 0d | 09 65 6c 73 65 0d 09 09 |Color);.|.else...|
|00003b10| 46 6f 72 65 43 6f 6c 6f | 72 28 77 68 69 74 65 43 |ForeColo|r(whiteC|
|00003b20| 6f 6c 6f 72 29 3b 0d 09 | 50 61 69 6e 74 4f 76 61 |olor);..|PaintOva|
|00003b30| 6c 28 26 67 53 74 6f 70 | 52 65 63 74 29 3b 0d 09 |l(&gStop|Rect);..|
|00003b40| 46 6f 72 65 43 6f 6c 6f | 72 28 62 6c 61 63 6b 43 |ForeColo|r(blackC|
|00003b50| 6f 6c 6f 72 29 3b 0d 09 | 46 72 61 6d 65 4f 76 61 |olor);..|FrameOva|
|00003b60| 6c 28 26 67 53 74 6f 70 | 52 65 63 74 29 3b 0d 09 |l(&gStop|Rect);..|
|00003b70| 69 66 20 28 20 21 20 67 | 53 74 6f 70 70 65 64 20 |if ( ! g|Stopped |
|00003b80| 29 09 09 09 09 2f 2a 20 | 64 72 61 77 20 61 20 67 |)..../* |draw a g|
|00003b90| 72 65 65 6e 20 28 6f 72 | 20 77 68 69 74 65 29 20 |reen (or| white) |
|00003ba0| 67 6f 20 6c 69 67 68 74 | 20 2a 2f 0d 09 09 46 6f |go light| */...Fo|
|00003bb0| 72 65 43 6f 6c 6f 72 28 | 67 72 65 65 6e 43 6f 6c |reColor(|greenCol|
|00003bc0| 6f 72 29 3b 0d 09 65 6c | 73 65 0d 09 09 46 6f 72 |or);..el|se...For|
|00003bd0| 65 43 6f 6c 6f 72 28 77 | 68 69 74 65 43 6f 6c 6f |eColor(w|hiteColo|
|00003be0| 72 29 3b 0d 09 50 61 69 | 6e 74 4f 76 61 6c 28 26 |r);..Pai|ntOval(&|
|00003bf0| 67 47 6f 52 65 63 74 29 | 3b 0d 09 46 6f 72 65 43 |gGoRect)|;..ForeC|
|00003c00| 6f 6c 6f 72 28 62 6c 61 | 63 6b 43 6f 6c 6f 72 29 |olor(bla|ckColor)|
|00003c10| 3b 0d 09 46 72 61 6d 65 | 4f 76 61 6c 28 26 67 47 |;..Frame|Oval(&gG|
|00003c20| 6f 52 65 63 74 29 3b 0d | 7d 20 2f 2a 44 72 61 77 |oRect);.|} /*Draw|
|00003c30| 57 69 6e 64 6f 77 2a 2f | 0d 0d 0d 2f 2a 09 45 6e |Window*/|.../*.En|
|00003c40| 61 62 6c 65 20 61 6e 64 | 20 64 69 73 61 62 6c 65 |able and| disable|
|00003c50| 20 6d 65 6e 75 73 20 62 | 61 73 65 64 20 6f 6e 20 | menus b|ased on |
|00003c60| 74 68 65 20 63 75 72 72 | 65 6e 74 20 73 74 61 74 |the curr|ent stat|
|00003c70| 65 2e 0d 09 54 68 65 20 | 75 73 65 72 20 63 61 6e |e...The |user can|
|00003c80| 20 6f 6e 6c 79 20 73 65 | 6c 65 63 74 20 65 6e 61 | only se|lect ena|
|00003c90| 62 6c 65 64 20 6d 65 6e | 75 20 69 74 65 6d 73 2e |bled men|u items.|
|00003ca0| 20 57 65 20 73 65 74 20 | 75 70 20 61 6c 6c 20 74 | We set |up all t|
|00003cb0| 68 65 20 6d 65 6e 75 20 | 69 74 65 6d 73 0d 09 62 |he menu |items..b|
|00003cc0| 65 66 6f 72 65 20 63 61 | 6c 6c 69 6e 67 20 4d 65 |efore ca|lling Me|
|00003cd0| 6e 75 53 65 6c 65 63 74 | 20 6f 72 20 4d 65 6e 75 |nuSelect| or Menu|
|00003ce0| 4b 65 79 2c 20 73 69 6e | 63 65 20 74 68 65 73 65 |Key, sin|ce these|
|00003cf0| 20 61 72 65 20 74 68 65 | 20 6f 6e 6c 79 20 74 69 | are the| only ti|
|00003d00| 6d 65 73 20 74 68 61 74 | 0d 09 61 20 6d 65 6e 75 |mes that|..a menu|
|00003d10| 20 69 74 65 6d 20 63 61 | 6e 20 62 65 20 73 65 6c | item ca|n be sel|
|00003d20| 65 63 74 65 64 2e 20 4e | 6f 74 65 20 74 68 61 74 |ected. N|ote that|
|00003d30| 20 4d 65 6e 75 53 65 6c | 65 63 74 20 69 73 20 61 | MenuSel|ect is a|
|00003d40| 6c 73 6f 20 74 68 65 20 | 6f 6e 6c 79 20 74 69 6d |lso the |only tim|
|00003d50| 65 0d 09 74 68 65 20 75 | 73 65 72 20 77 69 6c 6c |e..the u|ser will|
|00003d60| 20 73 65 65 20 6d 65 6e | 75 20 69 74 65 6d 73 2e | see men|u items.|
|00003d70| 20 54 68 69 73 20 61 70 | 70 72 6f 61 63 68 20 74 | This ap|proach t|
|00003d80| 6f 20 64 65 63 69 64 69 | 6e 67 20 77 68 61 74 20 |o decidi|ng what |
|00003d90| 65 6e 61 62 6c 65 2f 0d | 09 64 69 73 61 62 6c 65 |enable/.|.disable|
|00003da0| 20 73 74 61 74 65 20 61 | 20 6d 65 6e 75 20 69 74 | state a| menu it|
|00003db0| 65 6d 20 68 61 73 20 74 | 68 65 20 61 64 76 61 6e |em has t|he advan|
|00003dc0| 74 61 67 65 20 6f 66 20 | 63 6f 6e 63 65 6e 74 72 |tage of |concentr|
|00003dd0| 61 74 69 6e 67 20 61 6c | 6c 0d 09 74 68 65 20 64 |ating al|l..the d|
|00003de0| 65 63 69 73 69 6f 6e 2d | 6d 61 6b 69 6e 67 20 69 |ecision-|making i|
|00003df0| 6e 20 6f 6e 65 20 72 6f | 75 74 69 6e 65 2c 20 61 |n one ro|utine, a|
|00003e00| 73 20 6f 70 70 6f 73 65 | 64 20 74 6f 20 62 65 69 |s oppose|d to bei|
|00003e10| 6e 67 20 73 70 72 65 61 | 64 20 74 68 72 6f 75 67 |ng sprea|d throug|
|00003e20| 68 6f 75 74 0d 09 74 68 | 65 20 61 70 70 6c 69 63 |hout..th|e applic|
|00003e30| 61 74 69 6f 6e 2e 20 4f | 74 68 65 72 20 61 70 70 |ation. O|ther app|
|00003e40| 6c 69 63 61 74 69 6f 6e | 20 64 65 73 69 67 6e 73 |lication| designs|
|00003e50| 20 6d 61 79 20 74 61 6b | 65 20 61 20 64 69 66 66 | may tak|e a diff|
|00003e60| 65 72 65 6e 74 20 61 70 | 70 72 6f 61 63 68 0d 09 |erent ap|proach..|
|00003e70| 74 68 61 74 20 69 73 20 | 6a 75 73 74 20 61 73 20 |that is |just as |
|00003e80| 76 61 6c 69 64 2e 20 2a | 2f 0d 0d 23 70 72 61 67 |valid. *|/..#prag|
|00003e90| 6d 61 20 73 65 67 6d 65 | 6e 74 20 4d 61 69 6e 0d |ma segme|nt Main.|
|00003ea0| 76 6f 69 64 20 41 64 6a | 75 73 74 4d 65 6e 75 73 |void Adj|ustMenus|
|00003eb0| 28 29 0d 7b 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |().{..Wi|ndowPtr.|
|00003ec0| 77 69 6e 64 6f 77 3b 0d | 09 4d 65 6e 75 48 61 6e |window;.|.MenuHan|
|00003ed0| 64 6c 65 09 6d 65 6e 75 | 3b 0d 0d 09 77 69 6e 64 |dle.menu|;...wind|
|00003ee0| 6f 77 20 3d 20 46 72 6f | 6e 74 57 69 6e 64 6f 77 |ow = Fro|ntWindow|
|00003ef0| 28 29 3b 0d 0d 09 6d 65 | 6e 75 20 3d 20 47 65 74 |();...me|nu = Get|
|00003f00| 4d 48 61 6e 64 6c 65 28 | 6d 46 69 6c 65 29 3b 0d |MHandle(|mFile);.|
|00003f10| 09 69 66 20 28 20 49 73 | 44 41 57 69 6e 64 6f 77 |.if ( Is|DAWindow|
|00003f20| 28 77 69 6e 64 6f 77 29 | 20 29 09 09 2f 2a 20 77 |(window)| )../* w|
|00003f30| 65 20 63 61 6e 20 61 6c | 6c 6f 77 20 64 65 73 6b |e can al|low desk|
|00003f40| 20 61 63 63 65 73 73 6f | 72 69 65 73 20 74 6f 20 | accesso|ries to |
|00003f50| 62 65 20 63 6c 6f 73 65 | 64 20 66 72 6f 6d 20 74 |be close|d from t|
|00003f60| 68 65 20 6d 65 6e 75 20 | 2a 2f 0d 09 09 45 6e 61 |he menu |*/...Ena|
|00003f70| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 43 |bleItem(|menu, iC|
|00003f80| 6c 6f 73 65 29 3b 0d 09 | 65 6c 73 65 0d 09 09 44 |lose);..|else...D|
|00003f90| 69 73 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |isableIt|em(menu,|
|00003fa0| 20 69 43 6c 6f 73 65 29 | 3b 09 2f 2a 20 62 75 74 | iClose)|;./* but|
|00003fb0| 20 6e 6f 74 20 6f 75 72 | 20 74 72 61 66 66 69 63 | not our| traffic|
|00003fc0| 20 6c 69 67 68 74 20 77 | 69 6e 64 6f 77 20 2a 2f | light w|indow */|
|00003fd0| 0d 0d 09 6d 65 6e 75 20 | 3d 20 47 65 74 4d 48 61 |...menu |= GetMHa|
|00003fe0| 6e 64 6c 65 28 6d 45 64 | 69 74 29 3b 0d 09 69 66 |ndle(mEd|it);..if|
|00003ff0| 20 28 20 49 73 44 41 57 | 69 6e 64 6f 77 28 77 69 | ( IsDAW|indow(wi|
|00004000| 6e 64 6f 77 29 20 29 20 | 7b 09 09 2f 2a 20 61 20 |ndow) ) |{../* a |
|00004010| 64 65 73 6b 20 61 63 63 | 65 73 73 6f 72 79 20 6d |desk acc|essory m|
|00004020| 69 67 68 74 20 6e 65 65 | 64 20 74 68 65 20 65 64 |ight nee|d the ed|
|00004030| 69 74 20 6d 65 6e 75 c9 | 20 2a 2f 0d 09 09 45 6e |it menu.| */...En|
|00004040| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00004050| 55 6e 64 6f 29 3b 0d 09 | 09 45 6e 61 62 6c 65 49 |Undo);..|.EnableI|
|00004060| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 43 75 74 29 3b |tem(menu|, iCut);|
|00004070| 0d 09 09 45 6e 61 62 6c | 65 49 74 65 6d 28 6d 65 |...Enabl|eItem(me|
|00004080| 6e 75 2c 20 69 43 6f 70 | 79 29 3b 0d 09 09 45 6e |nu, iCop|y);...En|
|00004090| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|000040a0| 43 6c 65 61 72 29 3b 0d | 09 09 45 6e 61 62 6c 65 |Clear);.|..Enable|
|000040b0| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 50 61 73 74 |Item(men|u, iPast|
|000040c0| 65 29 3b 0d 09 7d 20 65 | 6c 73 65 20 7b 09 09 09 |e);..} e|lse {...|
|000040d0| 09 09 09 2f 2a 20 c9 62 | 75 74 20 77 65 20 64 6f |.../* .b|ut we do|
|000040e0| 6e d5 74 20 75 73 65 20 | 69 74 20 2a 2f 0d 09 09 |n.t use |it */...|
|000040f0| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |DisableI|tem(menu|
|00004100| 2c 20 69 55 6e 64 6f 29 | 3b 0d 09 09 44 69 73 61 |, iUndo)|;...Disa|
|00004110| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 43 |bleItem(|menu, iC|
|00004120| 75 74 29 3b 0d 09 09 44 | 69 73 61 62 6c 65 49 74 |ut);...D|isableIt|
|00004130| 65 6d 28 6d 65 6e 75 2c | 20 69 43 6f 70 79 29 3b |em(menu,| iCopy);|
|00004140| 0d 09 09 44 69 73 61 62 | 6c 65 49 74 65 6d 28 6d |...Disab|leItem(m|
|00004150| 65 6e 75 2c 20 69 43 6c | 65 61 72 29 3b 0d 09 09 |enu, iCl|ear);...|
|00004160| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |DisableI|tem(menu|
|00004170| 2c 20 69 50 61 73 74 65 | 29 3b 0d 09 7d 0d 0d 09 |, iPaste|);..}...|
|00004180| 6d 65 6e 75 20 3d 20 47 | 65 74 4d 48 61 6e 64 6c |menu = G|etMHandl|
|00004190| 65 28 6d 4c 69 67 68 74 | 29 3b 0d 09 69 66 20 28 |e(mLight|);..if (|
|000041a0| 20 49 73 41 70 70 57 69 | 6e 64 6f 77 28 77 69 6e | IsAppWi|ndow(win|
|000041b0| 64 6f 77 29 20 29 20 7b | 09 2f 2a 20 77 65 20 6b |dow) ) {|./* we k|
|000041c0| 6e 6f 77 20 74 68 61 74 | 20 69 74 20 6d 75 73 74 |now that| it must|
|000041d0| 20 62 65 20 74 68 65 20 | 74 72 61 66 66 69 63 20 | be the |traffic |
|000041e0| 6c 69 67 68 74 20 2a 2f | 0d 09 09 45 6e 61 62 6c |light */|...Enabl|
|000041f0| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 53 74 6f |eItem(me|nu, iSto|
|00004200| 70 29 3b 0d 09 09 45 6e | 61 62 6c 65 49 74 65 6d |p);...En|ableItem|
|00004210| 28 6d 65 6e 75 2c 20 69 | 47 6f 29 3b 0d 09 7d 20 |(menu, i|Go);..} |
|00004220| 65 6c 73 65 20 7b 0d 09 | 09 44 69 73 61 62 6c 65 |else {..|.Disable|
|00004230| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 53 74 6f 70 |Item(men|u, iStop|
|00004240| 29 3b 0d 09 09 44 69 73 | 61 62 6c 65 49 74 65 6d |);...Dis|ableItem|
|00004250| 28 6d 65 6e 75 2c 20 69 | 47 6f 29 3b 0d 09 7d 0d |(menu, i|Go);..}.|
|00004260| 09 43 68 65 63 6b 49 74 | 65 6d 28 6d 65 6e 75 2c |.CheckIt|em(menu,|
|00004270| 20 69 53 74 6f 70 2c 20 | 67 53 74 6f 70 70 65 64 | iStop, |gStopped|
|00004280| 29 3b 20 2f 2a 20 77 65 | 20 63 61 6e 20 61 6c 73 |); /* we| can als|
|00004290| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 63 68 65 63 |o determ|ine chec|
|000042a0| 6b 2f 75 6e 63 68 65 63 | 6b 20 73 74 61 74 65 2c |k/unchec|k state,|
|000042b0| 20 74 6f 6f 20 2a 2f 0d | 09 43 68 65 63 6b 49 74 | too */.|.CheckIt|
|000042c0| 65 6d 28 6d 65 6e 75 2c | 20 69 47 6f 2c 20 21 20 |em(menu,| iGo, ! |
|000042d0| 67 53 74 6f 70 70 65 64 | 29 3b 0d 7d 20 2f 2a 41 |gStopped|);.} /*A|
|000042e0| 64 6a 75 73 74 4d 65 6e | 75 73 2a 2f 0d 0d 0d 2f |djustMen|us*/.../|
|000042f0| 2a 09 54 68 69 73 20 69 | 73 20 63 61 6c 6c 65 64 |*.This i|s called|
|00004300| 20 77 68 65 6e 20 61 6e | 20 69 74 65 6d 20 69 73 | when an| item is|
|00004310| 20 63 68 6f 73 65 6e 20 | 66 72 6f 6d 20 74 68 65 | chosen |from the|
|00004320| 20 6d 65 6e 75 20 62 61 | 72 20 28 61 66 74 65 72 | menu ba|r (after|
|00004330| 20 63 61 6c 6c 69 6e 67 | 0d 09 4d 65 6e 75 53 65 | calling|..MenuSe|
|00004340| 6c 65 63 74 20 6f 72 20 | 4d 65 6e 75 4b 65 79 29 |lect or |MenuKey)|
|00004350| 2e 20 49 74 20 70 65 72 | 66 6f 72 6d 73 20 74 68 |. It per|forms th|
|00004360| 65 20 72 69 67 68 74 20 | 6f 70 65 72 61 74 69 6f |e right |operatio|
|00004370| 6e 20 66 6f 72 20 65 61 | 63 68 20 63 6f 6d 6d 61 |n for ea|ch comma|
|00004380| 6e 64 2e 0d 09 49 74 20 | 69 73 20 67 6f 6f 64 20 |nd...It |is good |
|00004390| 74 6f 20 68 61 76 65 20 | 62 6f 74 68 20 74 68 65 |to have |both the|
|000043a0| 20 72 65 73 75 6c 74 20 | 6f 66 20 4d 65 6e 75 53 | result |of MenuS|
|000043b0| 65 6c 65 63 74 20 61 6e | 64 20 4d 65 6e 75 4b 65 |elect an|d MenuKe|
|000043c0| 79 20 67 6f 20 74 6f 0d | 09 6f 6e 65 20 72 6f 75 |y go to.|.one rou|
|000043d0| 74 69 6e 65 20 6c 69 6b | 65 20 74 68 69 73 20 74 |tine lik|e this t|
|000043e0| 6f 20 6b 65 65 70 20 65 | 76 65 72 79 74 68 69 6e |o keep e|verythin|
|000043f0| 67 20 6f 72 67 61 6e 69 | 7a 65 64 2e 20 2a 2f 0d |g organi|zed. */.|
|00004400| 0d 23 70 72 61 67 6d 61 | 20 73 65 67 6d 65 6e 74 |.#pragma| segment|
|00004410| 20 4d 61 69 6e 0d 76 6f | 69 64 20 44 6f 4d 65 6e | Main.vo|id DoMen|
|00004420| 75 43 6f 6d 6d 61 6e 64 | 28 6d 65 6e 75 52 65 73 |uCommand|(menuRes|
|00004430| 75 6c 74 29 0d 09 6c 6f | 6e 67 09 09 6d 65 6e 75 |ult)..lo|ng..menu|
|00004440| 52 65 73 75 6c 74 3b 0d | 7b 0d 09 73 68 6f 72 74 |Result;.|{..short|
|00004450| 09 09 6d 65 6e 75 49 44 | 3b 09 09 09 09 2f 2a 20 |..menuID|;..../* |
|00004460| 74 68 65 20 72 65 73 6f | 75 72 63 65 20 49 44 20 |the reso|urce ID |
|00004470| 6f 66 20 74 68 65 20 73 | 65 6c 65 63 74 65 64 20 |of the s|elected |
|00004480| 6d 65 6e 75 20 2a 2f 0d | 09 73 68 6f 72 74 09 09 |menu */.|.short..|
|00004490| 6d 65 6e 75 49 74 65 6d | 3b 09 09 09 2f 2a 20 74 |menuItem|;.../* t|
|000044a0| 68 65 20 69 74 65 6d 20 | 6e 75 6d 62 65 72 20 6f |he item |number o|
|000044b0| 66 20 74 68 65 20 73 65 | 6c 65 63 74 65 64 20 6d |f the se|lected m|
|000044c0| 65 6e 75 20 2a 2f 0d 09 | 73 68 6f 72 74 09 09 69 |enu */..|short..i|
|000044d0| 74 65 6d 48 69 74 3b 0d | 09 53 74 72 32 35 35 09 |temHit;.|.Str255.|
|000044e0| 09 64 61 4e 61 6d 65 3b | 0d 09 73 68 6f 72 74 09 |.daName;|..short.|
|000044f0| 09 64 61 52 65 66 4e 75 | 6d 3b 0d 09 42 6f 6f 6c |.daRefNu|m;..Bool|
|00004500| 65 61 6e 09 09 68 61 6e | 64 6c 65 64 42 79 44 41 |ean..han|dledByDA|
|00004510| 3b 0d 0d 09 6d 65 6e 75 | 49 44 20 3d 20 48 69 57 |;...menu|ID = HiW|
|00004520| 6f 72 64 28 6d 65 6e 75 | 52 65 73 75 6c 74 29 3b |ord(menu|Result);|
|00004530| 09 2f 2a 20 75 73 65 20 | 6d 61 63 72 6f 73 20 66 |./* use |macros f|
|00004540| 6f 72 20 65 66 66 69 63 | 69 65 6e 63 79 20 74 6f |or effic|iency to|
|00004550| 2e 2e 2e 20 2a 2f 0d 09 | 6d 65 6e 75 49 74 65 6d |... */..|menuItem|
|00004560| 20 3d 20 4c 6f 57 6f 72 | 64 28 6d 65 6e 75 52 65 | = LoWor|d(menuRe|
|00004570| 73 75 6c 74 29 3b 09 2f | 2a 20 67 65 74 20 6d 65 |sult);./|* get me|
|00004580| 6e 75 20 69 74 65 6d 20 | 6e 75 6d 62 65 72 20 61 |nu item |number a|
|00004590| 6e 64 20 6d 65 6e 75 20 | 6e 75 6d 62 65 72 20 2a |nd menu |number *|
|000045a0| 2f 0d 09 73 77 69 74 63 | 68 20 28 20 6d 65 6e 75 |/..switc|h ( menu|
|000045b0| 49 44 20 29 20 7b 0d 09 | 09 63 61 73 65 20 6d 41 |ID ) {..|.case mA|
|000045c0| 70 70 6c 65 3a 0d 09 09 | 09 73 77 69 74 63 68 20 |pple:...|.switch |
|000045d0| 28 20 6d 65 6e 75 49 74 | 65 6d 20 29 20 7b 0d 09 |( menuIt|em ) {..|
|000045e0| 09 09 09 63 61 73 65 20 | 69 41 62 6f 75 74 3a 09 |...case |iAbout:.|
|000045f0| 09 2f 2a 20 62 72 69 6e | 67 20 75 70 20 61 6c 65 |./* brin|g up ale|
|00004600| 72 74 20 66 6f 72 20 41 | 62 6f 75 74 20 2a 2f 0d |rt for A|bout */.|
|00004610| 09 09 09 09 09 69 74 65 | 6d 48 69 74 20 3d 20 41 |.....ite|mHit = A|
|00004620| 6c 65 72 74 28 72 41 62 | 6f 75 74 41 6c 65 72 74 |lert(rAb|outAlert|
|00004630| 2c 20 6e 69 6c 29 3b 0d | 09 09 09 09 09 62 72 65 |, nil);.|.....bre|
|00004640| 61 6b 3b 0d 09 09 09 09 | 64 65 66 61 75 6c 74 3a |ak;.....|default:|
|00004650| 09 09 09 2f 2a 20 61 6c | 6c 20 6e 6f 6e 2d 41 62 |.../* al|l non-Ab|
|00004660| 6f 75 74 20 69 74 65 6d | 73 20 69 6e 20 74 68 69 |out item|s in thi|
|00004670| 73 20 6d 65 6e 75 20 61 | 72 65 20 44 41 73 20 2a |s menu a|re DAs *|
|00004680| 2f 0d 09 09 09 09 09 2f | 2a 20 74 79 70 65 20 53 |/....../|* type S|
|00004690| 74 72 32 35 35 20 69 73 | 20 61 6e 20 61 72 72 61 |tr255 is| an arra|
|000046a0| 79 20 69 6e 20 4d 50 57 | 20 33 20 2a 2f 0d 09 09 |y in MPW| 3 */...|
|000046b0| 09 09 09 47 65 74 49 74 | 65 6d 28 47 65 74 4d 48 |...GetIt|em(GetMH|
|000046c0| 61 6e 64 6c 65 28 6d 41 | 70 70 6c 65 29 2c 20 6d |andle(mA|pple), m|
|000046d0| 65 6e 75 49 74 65 6d 2c | 20 64 61 4e 61 6d 65 29 |enuItem,| daName)|
|000046e0| 3b 0d 09 09 09 09 09 64 | 61 52 65 66 4e 75 6d 20 |;......d|aRefNum |
|000046f0| 3d 20 4f 70 65 6e 44 65 | 73 6b 41 63 63 28 64 61 |= OpenDe|skAcc(da|
|00004700| 4e 61 6d 65 29 3b 0d 09 | 09 09 09 09 62 72 65 61 |Name);..|....brea|
|00004710| 6b 3b 0d 09 09 09 7d 0d | 09 09 09 62 72 65 61 6b |k;....}.|...break|
|00004720| 3b 0d 09 09 63 61 73 65 | 20 6d 46 69 6c 65 3a 0d |;...case| mFile:.|
|00004730| 09 09 09 73 77 69 74 63 | 68 20 28 20 6d 65 6e 75 |...switc|h ( menu|
|00004740| 49 74 65 6d 20 29 20 7b | 0d 09 09 09 09 63 61 73 |Item ) {|.....cas|
|00004750| 65 20 69 43 6c 6f 73 65 | 3a 0d 09 09 09 09 09 44 |e iClose|:......D|
|00004760| 6f 43 6c 6f 73 65 57 69 | 6e 64 6f 77 28 46 72 6f |oCloseWi|ndow(Fro|
|00004770| 6e 74 57 69 6e 64 6f 77 | 28 29 29 3b 0d 09 09 09 |ntWindow|());....|
|00004780| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 09 63 61 73 |..break;|.....cas|
|00004790| 65 20 69 51 75 69 74 3a | 0d 09 09 09 09 09 54 65 |e iQuit:|......Te|
|000047a0| 72 6d 69 6e 61 74 65 28 | 29 3b 0d 09 09 09 09 09 |rminate(|);......|
|000047b0| 62 72 65 61 6b 3b 0d 09 | 09 09 7d 0d 09 09 09 62 |break;..|..}....b|
|000047c0| 72 65 61 6b 3b 0d 09 09 | 63 61 73 65 20 6d 45 64 |reak;...|case mEd|
|000047d0| 69 74 3a 09 09 09 09 09 | 2f 2a 20 63 61 6c 6c 20 |it:.....|/* call |
|000047e0| 53 79 73 74 65 6d 45 64 | 69 74 20 66 6f 72 20 44 |SystemEd|it for D|
|000047f0| 41 20 65 64 69 74 69 6e | 67 20 26 20 4d 75 6c 74 |A editin|g & Mult|
|00004800| 69 46 69 6e 64 65 72 20 | 2a 2f 0d 09 09 09 68 61 |iFinder |*/....ha|
|00004810| 6e 64 6c 65 64 42 79 44 | 41 20 3d 20 53 79 73 74 |ndledByD|A = Syst|
|00004820| 65 6d 45 64 69 74 28 6d | 65 6e 75 49 74 65 6d 2d |emEdit(m|enuItem-|
|00004830| 31 29 3b 09 2f 2a 20 73 | 69 6e 63 65 20 77 65 20 |1);./* s|ince we |
|00004840| 64 6f 6e d5 74 20 64 6f | 20 61 6e 79 20 45 64 69 |don.t do| any Edi|
|00004850| 74 69 6e 67 20 2a 2f 0d | 09 09 09 62 72 65 61 6b |ting */.|...break|
|00004860| 3b 0d 09 09 63 61 73 65 | 20 6d 4c 69 67 68 74 3a |;...case| mLight:|
|00004870| 0d 09 09 09 73 77 69 74 | 63 68 20 28 20 6d 65 6e |....swit|ch ( men|
|00004880| 75 49 74 65 6d 20 29 20 | 7b 0d 09 09 09 09 63 61 |uItem ) |{.....ca|
|00004890| 73 65 20 69 53 74 6f 70 | 3a 0d 09 09 09 09 09 53 |se iStop|:......S|
|000048a0| 65 74 4c 69 67 68 74 28 | 46 72 6f 6e 74 57 69 6e |etLight(|FrontWin|
|000048b0| 64 6f 77 28 29 2c 20 74 | 72 75 65 29 3b 0d 09 09 |dow(), t|rue);...|
|000048c0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|000048d0| 73 65 20 69 47 6f 3a 0d | 09 09 09 09 09 53 65 74 |se iGo:.|.....Set|
|000048e0| 4c 69 67 68 74 28 46 72 | 6f 6e 74 57 69 6e 64 6f |Light(Fr|ontWindo|
|000048f0| 77 28 29 2c 20 66 61 6c | 73 65 29 3b 0d 09 09 09 |w(), fal|se);....|
|00004900| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 7d 0d 09 09 |..break;|....}...|
|00004910| 09 62 72 65 61 6b 3b 0d | 09 7d 0d 09 48 69 6c 69 |.break;.|.}..Hili|
|00004920| 74 65 4d 65 6e 75 28 30 | 29 3b 09 09 09 09 09 2f |teMenu(0|);...../|
|00004930| 2a 20 75 6e 68 69 67 68 | 6c 69 67 68 74 20 77 68 |* unhigh|light wh|
|00004940| 61 74 20 4d 65 6e 75 53 | 65 6c 65 63 74 20 28 6f |at MenuS|elect (o|
|00004950| 72 20 4d 65 6e 75 4b 65 | 79 29 20 68 69 6c 69 74 |r MenuKe|y) hilit|
|00004960| 65 64 20 2a 2f 0d 7d 20 | 2f 2a 44 6f 4d 65 6e 75 |ed */.} |/*DoMenu|
|00004970| 43 6f 6d 6d 61 6e 64 2a | 2f 0d 0d 0d 2f 2a 20 43 |Command*|/.../* C|
|00004980| 68 61 6e 67 65 20 74 68 | 65 20 73 65 74 74 69 6e |hange th|e settin|
|00004990| 67 20 6f 66 20 74 68 65 | 20 6c 69 67 68 74 2e 20 |g of the| light. |
|000049a0| 2a 2f 0d 0d 23 70 72 61 | 67 6d 61 20 73 65 67 6d |*/..#pra|gma segm|
|000049b0| 65 6e 74 20 4d 61 69 6e | 0d 76 6f 69 64 20 53 65 |ent Main|.void Se|
|000049c0| 74 4c 69 67 68 74 28 20 | 77 69 6e 64 6f 77 2c 20 |tLight( |window, |
|000049d0| 6e 65 77 53 74 6f 70 70 | 65 64 20 29 0d 09 57 69 |newStopp|ed )..Wi|
|000049e0| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|000049f0| 09 42 6f 6f 6c 65 61 6e | 09 09 6e 65 77 53 74 6f |.Boolean|..newSto|
|00004a00| 70 70 65 64 3b 0d 7b 0d | 09 69 66 20 28 20 6e 65 |pped;.{.|.if ( ne|
|00004a10| 77 53 74 6f 70 70 65 64 | 20 21 3d 20 67 53 74 6f |wStopped| != gSto|
|00004a20| 70 70 65 64 20 29 20 7b | 0d 09 09 67 53 74 6f 70 |pped ) {|...gStop|
|00004a30| 70 65 64 20 3d 20 6e 65 | 77 53 74 6f 70 70 65 64 |ped = ne|wStopped|
|00004a40| 3b 0d 09 09 53 65 74 50 | 6f 72 74 28 77 69 6e 64 |;...SetP|ort(wind|
|00004a50| 6f 77 29 3b 0d 09 09 49 | 6e 76 61 6c 52 65 63 74 |ow);...I|nvalRect|
|00004a60| 28 26 77 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |(&window|->portRe|
|00004a70| 63 74 29 3b 0d 09 7d 0d | 7d 20 2f 2a 53 65 74 4c |ct);..}.|} /*SetL|
|00004a80| 69 67 68 74 2a 2f 0d 0d | 0d 2f 2a 20 43 6c 6f 73 |ight*/..|./* Clos|
|00004a90| 65 20 61 20 77 69 6e 64 | 6f 77 2e 20 54 68 69 73 |e a wind|ow. This|
|00004aa0| 20 68 61 6e 64 6c 65 73 | 20 64 65 73 6b 20 61 63 | handles| desk ac|
|00004ab0| 63 65 73 73 6f 72 79 20 | 61 6e 64 20 61 70 70 6c |cessory |and appl|
|00004ac0| 69 63 61 74 69 6f 6e 20 | 77 69 6e 64 6f 77 73 2e |ication |windows.|
|00004ad0| 20 2a 2f 0d 0d 2f 2a 09 | 31 2e 30 31 20 2d 20 41 | */../*.|1.01 - A|
|00004ae0| 74 20 74 68 69 73 20 70 | 6f 69 6e 74 2c 20 69 66 |t this p|oint, if|
|00004af0| 20 74 68 65 72 65 20 77 | 61 73 20 61 20 64 6f 63 | there w|as a doc|
|00004b00| 75 6d 65 6e 74 20 61 73 | 73 6f 63 69 61 74 65 64 |ument as|sociated|
|00004b10| 20 77 69 74 68 20 61 0d | 09 77 69 6e 64 6f 77 2c | with a.|.window,|
|00004b20| 20 79 6f 75 20 63 6f 75 | 6c 64 20 64 6f 20 61 6e | you cou|ld do an|
|00004b30| 79 20 64 6f 63 75 6d 65 | 6e 74 20 73 61 76 69 6e |y docume|nt savin|
|00004b40| 67 20 70 72 6f 63 65 73 | 73 69 6e 67 20 69 66 20 |g proces|sing if |
|00004b50| 69 74 20 69 73 20 27 64 | 69 72 74 79 27 2e 0d 09 |it is 'd|irty'...|
|00004b60| 44 6f 43 6c 6f 73 65 57 | 69 6e 64 6f 77 20 77 6f |DoCloseW|indow wo|
|00004b70| 75 6c 64 20 72 65 74 75 | 72 6e 20 74 72 75 65 20 |uld retu|rn true |
|00004b80| 69 66 20 74 68 65 20 77 | 69 6e 64 6f 77 20 61 63 |if the w|indow ac|
|00004b90| 74 75 61 6c 6c 79 20 63 | 6c 6f 73 65 64 2c 20 69 |tually c|losed, i|
|00004ba0| 2e 65 2e 2c 0d 09 74 68 | 65 20 75 73 65 72 20 64 |.e.,..th|e user d|
|00004bb0| 69 64 6e d5 74 20 63 61 | 6e 63 65 6c 20 66 72 6f |idn.t ca|ncel fro|
|00004bc0| 6d 20 61 20 73 61 76 65 | 20 64 69 61 6c 6f 67 2e |m a save| dialog.|
|00004bd0| 20 54 68 69 73 20 72 65 | 73 75 6c 74 20 69 73 20 | This re|sult is |
|00004be0| 68 61 6e 64 79 20 77 68 | 65 6e 0d 09 74 68 65 20 |handy wh|en..the |
|00004bf0| 75 73 65 72 20 71 75 69 | 74 73 20 61 6e 20 61 70 |user qui|ts an ap|
|00004c00| 70 6c 69 63 61 74 69 6f | 6e 2c 20 62 75 74 20 74 |plicatio|n, but t|
|00004c10| 68 65 6e 20 63 61 6e 63 | 65 6c 73 20 74 68 65 20 |hen canc|els the |
|00004c20| 73 61 76 65 20 6f 66 20 | 61 20 64 6f 63 75 6d 65 |save of |a docume|
|00004c30| 6e 74 0d 09 61 73 73 6f | 63 69 61 74 65 64 20 77 |nt..asso|ciated w|
|00004c40| 69 74 68 20 61 20 77 69 | 6e 64 6f 77 2e 20 2a 2f |ith a wi|ndow. */|
|00004c50| 0d 0d 23 70 72 61 67 6d | 61 20 73 65 67 6d 65 6e |..#pragm|a segmen|
|00004c60| 74 20 4d 61 69 6e 0d 42 | 6f 6f 6c 65 61 6e 20 44 |t Main.B|oolean D|
|00004c70| 6f 43 6c 6f 73 65 57 69 | 6e 64 6f 77 28 77 69 6e |oCloseWi|ndow(win|
|00004c80| 64 6f 77 29 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |dow)..Wi|ndowPtr.|
|00004c90| 77 69 6e 64 6f 77 3b 0d | 7b 0d 09 69 66 20 28 20 |window;.|{..if ( |
|00004ca0| 49 73 44 41 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |IsDAWind|ow(windo|
|00004cb0| 77 29 20 29 0d 09 09 43 | 6c 6f 73 65 44 65 73 6b |w) )...C|loseDesk|
|00004cc0| 41 63 63 28 28 28 57 69 | 6e 64 6f 77 50 65 65 6b |Acc(((Wi|ndowPeek|
|00004cd0| 29 20 77 69 6e 64 6f 77 | 29 2d 3e 77 69 6e 64 6f |) window|)->windo|
|00004ce0| 77 4b 69 6e 64 29 3b 0d | 09 65 6c 73 65 20 69 66 |wKind);.|.else if|
|00004cf0| 20 28 20 49 73 41 70 70 | 57 69 6e 64 6f 77 28 77 | ( IsApp|Window(w|
|00004d00| 69 6e 64 6f 77 29 20 29 | 0d 09 09 43 6c 6f 73 65 |indow) )|...Close|
|00004d10| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 3b 0d |Window(w|indow);.|
|00004d20| 09 72 65 74 75 72 6e 20 | 74 72 75 65 3b 0d 7d 20 |.return |true;.} |
|00004d30| 2f 2a 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 2a |/*DoClos|eWindow*|
|00004d40| 2f 0d 0d 0d 2f 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/.../***|********|
|00004d50| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d60| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d70| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 0d 2a 2a 2a 20 |********|***.*** |
|00004da0| 31 2e 30 31 20 44 6f 43 | 6c 6f 73 65 42 65 68 69 |1.01 DoC|loseBehi|
|00004db0| 6e 64 28 77 69 6e 64 6f | 77 29 20 77 61 73 20 72 |nd(windo|w) was r|
|00004dc0| 65 6d 6f 76 65 64 20 2a | 2a 2a 0d 0d 09 31 2e 30 |emoved *|**...1.0|
|00004dd0| 31 20 2d 20 44 6f 43 6c | 6f 73 65 42 65 68 69 6e |1 - DoCl|oseBehin|
|00004de0| 64 20 77 61 73 20 61 20 | 67 6f 6f 64 20 69 64 65 |d was a |good ide|
|00004df0| 61 20 66 6f 72 20 63 6c | 6f 73 69 6e 67 20 77 69 |a for cl|osing wi|
|00004e00| 6e 64 6f 77 73 20 77 68 | 65 6e 20 71 75 69 74 74 |ndows wh|en quitt|
|00004e10| 69 6e 67 0d 09 61 6e 64 | 20 6e 6f 74 20 68 61 76 |ing..and| not hav|
|00004e20| 69 6e 67 20 74 6f 20 77 | 6f 72 72 79 20 61 62 6f |ing to w|orry abo|
|00004e30| 75 74 20 75 70 64 61 74 | 69 6e 67 20 74 68 65 20 |ut updat|ing the |
|00004e40| 77 69 6e 64 6f 77 73 2c | 20 62 75 74 20 69 74 20 |windows,| but it |
|00004e50| 73 75 66 66 65 72 65 64 | 0d 09 66 72 6f 6d 20 61 |suffered|..from a|
|00004e60| 20 66 61 74 61 6c 20 66 | 6c 61 77 2e 20 49 66 20 | fatal f|law. If |
|00004e70| 61 20 64 65 73 6b 20 61 | 63 63 65 73 73 6f 72 79 |a desk a|ccessory|
|00004e80| 20 6f 77 6e 65 64 20 74 | 77 6f 20 77 69 6e 64 6f | owned t|wo windo|
|00004e90| 77 73 2c 20 69 74 20 77 | 6f 75 6c 64 0d 09 63 6c |ws, it w|ould..cl|
|00004ea0| 6f 73 65 20 62 6f 74 68 | 20 74 68 6f 73 65 20 77 |ose both| those w|
|00004eb0| 69 6e 64 6f 77 73 20 77 | 68 65 6e 20 43 6c 6f 73 |indows w|hen Clos|
|00004ec0| 65 44 65 73 6b 41 63 63 | 20 77 61 73 20 63 61 6c |eDeskAcc| was cal|
|00004ed0| 6c 65 64 2e 20 57 68 65 | 6e 20 44 6f 43 6c 6f 73 |led. Whe|n DoClos|
|00004ee0| 65 42 65 68 69 6e 64 0d | 09 67 6f 74 20 61 72 6f |eBehind.|.got aro|
|00004ef0| 75 6e 64 20 74 6f 20 63 | 61 6c 6c 69 6e 67 20 44 |und to c|alling D|
|00004f00| 6f 43 6c 6f 73 65 57 69 | 6e 64 6f 77 20 66 6f 72 |oCloseWi|ndow for|
|00004f10| 20 74 68 61 74 20 6f 74 | 68 65 72 20 77 69 6e 64 | that ot|her wind|
|00004f20| 6f 77 20 74 68 61 74 20 | 77 61 73 20 61 6c 72 65 |ow that |was alre|
|00004f30| 61 64 79 0d 09 63 6c 6f | 73 65 64 2c 20 74 68 69 |ady..clo|sed, thi|
|00004f40| 6e 67 73 20 77 6f 75 6c | 64 20 67 6f 20 76 65 72 |ngs woul|d go ver|
|00004f50| 79 20 70 6f 6f 72 6c 79 | 2e 20 41 6e 6f 74 68 65 |y poorly|. Anothe|
|00004f60| 72 20 6f 70 74 69 6f 6e | 20 77 6f 75 6c 64 20 62 |r option| would b|
|00004f70| 65 20 74 6f 20 68 61 76 | 65 20 61 0d 09 70 72 6f |e to hav|e a..pro|
|00004f80| 63 65 64 75 72 65 2c 20 | 47 65 74 52 65 61 72 57 |cedure, |GetRearW|
|00004f90| 69 6e 64 6f 77 2c 20 74 | 68 61 74 20 77 6f 75 6c |indow, t|hat woul|
|00004fa0| 64 20 67 6f 20 74 68 72 | 6f 75 67 68 20 74 68 65 |d go thr|ough the|
|00004fb0| 20 77 69 6e 64 6f 77 20 | 6c 69 73 74 20 61 6e 64 | window |list and|
|00004fc0| 20 72 65 74 75 72 6e 0d | 09 74 68 65 20 6c 61 73 | return.|.the las|
|00004fd0| 74 20 77 69 6e 64 6f 77 | 2e 20 49 6e 73 74 65 61 |t window|. Instea|
|00004fe0| 64 2c 20 77 65 20 64 65 | 63 69 64 65 64 20 74 6f |d, we de|cided to|
|00004ff0| 20 70 72 65 73 65 6e 74 | 20 74 68 65 20 73 74 61 | present| the sta|
|00005000| 6e 64 61 72 64 20 61 70 | 70 72 6f 61 63 68 0d 09 |ndard ap|proach..|
|00005010| 6f 66 20 67 65 74 74 69 | 6e 67 20 61 6e 64 20 63 |of getti|ng and c|
|00005020| 6c 6f 73 69 6e 67 20 46 | 72 6f 6e 74 57 69 6e 64 |losing F|rontWind|
|00005030| 6f 77 20 75 6e 74 69 6c | 20 46 72 6f 6e 74 57 69 |ow until| FrontWi|
|00005040| 6e 64 6f 77 20 72 65 74 | 75 72 6e 73 20 4e 49 4c |ndow ret|urns NIL|
|00005050| 2e 20 54 68 69 73 0d 09 | 68 61 73 20 61 20 70 6f |. This..|has a po|
|00005060| 74 65 6e 74 69 61 6c 20 | 62 65 6e 65 66 69 74 20 |tential |benefit |
|00005070| 69 6e 20 74 68 61 74 20 | 74 68 65 20 77 69 6e 64 |in that |the wind|
|00005080| 6f 77 20 77 68 6f 73 65 | 20 64 6f 63 75 6d 65 6e |ow whose| documen|
|00005090| 74 20 6e 65 65 64 73 20 | 74 6f 20 62 65 20 73 61 |t needs |to be sa|
|000050a0| 76 65 64 0d 09 6d 61 79 | 20 62 65 20 76 69 73 69 |ved..may| be visi|
|000050b0| 62 6c 65 20 73 69 6e 63 | 65 20 69 74 20 69 73 20 |ble sinc|e it is |
|000050c0| 74 68 65 20 66 72 6f 6e | 74 20 77 69 6e 64 6f 77 |the fron|t window|
|000050d0| 2c 20 74 68 65 72 65 66 | 6f 72 65 20 64 65 63 72 |, theref|ore decr|
|000050e0| 65 61 73 69 6e 67 20 74 | 68 65 0d 09 63 68 61 6e |easing t|he..chan|
|000050f0| 63 65 20 6f 66 20 75 73 | 65 72 20 63 6f 6e 66 75 |ce of us|er confu|
|00005100| 73 69 6f 6e 2e 20 46 6f | 72 20 61 65 73 74 68 65 |sion. Fo|r aesthe|
|00005110| 74 69 63 20 72 65 61 73 | 6f 6e 73 2c 20 74 68 65 |tic reas|ons, the|
|00005120| 20 77 69 6e 64 6f 77 73 | 20 69 6e 20 74 68 65 0d | windows| in the.|
|00005130| 09 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 73 68 6f |.applica|tion sho|
|00005140| 75 6c 64 20 62 65 20 63 | 68 65 63 6b 65 64 20 66 |uld be c|hecked f|
|00005150| 6f 72 20 75 70 64 61 74 | 65 73 20 70 65 72 69 6f |or updat|es perio|
|00005160| 64 69 63 61 6c 6c 79 20 | 61 6e 64 20 68 61 76 65 |dically |and have|
|00005170| 20 74 68 65 0d 09 75 70 | 64 61 74 65 73 20 73 65 | the..up|dates se|
|00005180| 72 76 69 63 65 64 2e 0d | 2a 2a 2a 2a 2a 2a 2a 2a |rviced..|********|
|00005190| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000051d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2f 0d |********|******/.|
|000051e0| 0d 0d 2f 2a 20 43 6c 65 | 61 6e 20 75 70 20 74 68 |../* Cle|an up th|
|000051f0| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 61 6e |e applic|ation an|
|00005200| 64 20 65 78 69 74 2e 20 | 57 65 20 63 6c 6f 73 65 |d exit. |We close|
|00005210| 20 61 6c 6c 20 6f 66 20 | 74 68 65 20 77 69 6e 64 | all of |the wind|
|00005220| 6f 77 73 20 73 6f 20 74 | 68 61 74 0d 20 74 68 65 |ows so t|hat. the|
|00005230| 79 20 63 61 6e 20 75 70 | 64 61 74 65 20 74 68 65 |y can up|date the|
|00005240| 69 72 20 64 6f 63 75 6d | 65 6e 74 73 2c 20 69 66 |ir docum|ents, if|
|00005250| 20 61 6e 79 2e 20 2a 2f | 0d 20 0d 2f 2a 09 31 2e | any. */|. ./*.1.|
|00005260| 30 31 20 2d 20 49 66 20 | 77 65 20 66 69 6e 64 20 |01 - If |we find |
|00005270| 6f 75 74 20 74 68 61 74 | 20 61 20 63 61 6e 63 65 |out that| a cance|
|00005280| 6c 20 68 61 73 20 6f 63 | 63 75 72 72 65 64 2c 20 |l has oc|curred, |
|00005290| 77 65 20 77 6f 6e 27 74 | 20 65 78 69 74 20 74 6f |we won't| exit to|
|000052a0| 20 74 68 65 0d 09 73 68 | 65 6c 6c 2c 20 62 75 74 | the..sh|ell, but|
|000052b0| 20 77 69 6c 6c 20 72 65 | 74 75 72 6e 20 69 6e 73 | will re|turn ins|
|000052c0| 74 65 61 64 2e 20 2a 2f | 0d 0d 23 70 72 61 67 6d |tead. */|..#pragm|
|000052d0| 61 20 73 65 67 6d 65 6e | 74 20 4d 61 69 6e 0d 76 |a segmen|t Main.v|
|000052e0| 6f 69 64 20 54 65 72 6d | 69 6e 61 74 65 28 29 0d |oid Term|inate().|
|000052f0| 7b 0d 09 57 69 6e 64 6f | 77 50 74 72 09 61 57 69 |{..Windo|wPtr.aWi|
|00005300| 6e 64 6f 77 3b 0d 09 42 | 6f 6f 6c 65 61 6e 09 09 |ndow;..B|oolean..|
|00005310| 63 6c 6f 73 65 64 3b 0d | 09 0d 09 63 6c 6f 73 65 |closed;.|...close|
|00005320| 64 20 3d 20 74 72 75 65 | 3b 0d 09 64 6f 20 7b 0d |d = true|;..do {.|
|00005330| 09 09 61 57 69 6e 64 6f | 77 20 3d 20 46 72 6f 6e |..aWindo|w = Fron|
|00005340| 74 57 69 6e 64 6f 77 28 | 29 3b 09 09 09 09 2f 2a |tWindow(|);..../*|
|00005350| 20 67 65 74 20 74 68 65 | 20 63 75 72 72 65 6e 74 | get the| current|
|00005360| 20 66 72 6f 6e 74 20 77 | 69 6e 64 6f 77 20 2a 2f | front w|indow */|
|00005370| 0d 09 09 69 66 20 28 61 | 57 69 6e 64 6f 77 20 21 |...if (a|Window !|
|00005380| 3d 20 6e 69 6c 29 0d 09 | 09 09 63 6c 6f 73 65 64 |= nil)..|..closed|
|00005390| 20 3d 20 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 | = DoClo|seWindow|
|000053a0| 28 61 57 69 6e 64 6f 77 | 29 3b 09 2f 2a 20 63 6c |(aWindow|);./* cl|
|000053b0| 6f 73 65 20 74 68 69 73 | 20 77 69 6e 64 6f 77 20 |ose this| window |
|000053c0| 2a 2f 09 0d 09 7d 0d 09 | 77 68 69 6c 65 20 28 63 |*/...}..|while (c|
|000053d0| 6c 6f 73 65 64 20 26 26 | 20 28 61 57 69 6e 64 6f |losed &&| (aWindo|
|000053e0| 77 20 21 3d 20 6e 69 6c | 29 29 3b 0d 09 69 66 20 |w != nil|));..if |
|000053f0| 28 63 6c 6f 73 65 64 29 | 0d 09 09 45 78 69 74 54 |(closed)|...ExitT|
|00005400| 6f 53 68 65 6c 6c 28 29 | 3b 09 09 09 09 09 09 09 |oShell()|;.......|
|00005410| 2f 2a 20 65 78 69 74 20 | 69 66 20 6e 6f 20 63 61 |/* exit |if no ca|
|00005420| 6e 63 65 6c 6c 61 74 69 | 6f 6e 20 2a 2f 0d 7d 20 |ncellati|on */.} |
|00005430| 2f 2a 54 65 72 6d 69 6e | 61 74 65 2a 2f 0d 0d 0d |/*Termin|ate*/...|
|00005440| 2f 2a 09 53 65 74 20 75 | 70 20 74 68 65 20 77 68 |/*.Set u|p the wh|
|00005450| 6f 6c 65 20 77 6f 72 6c | 64 2c 20 69 6e 63 6c 75 |ole worl|d, inclu|
|00005460| 64 69 6e 67 20 67 6c 6f | 62 61 6c 20 76 61 72 69 |ding glo|bal vari|
|00005470| 61 62 6c 65 73 2c 20 54 | 6f 6f 6c 62 6f 78 20 6d |ables, T|oolbox m|
|00005480| 61 6e 61 67 65 72 73 2c | 0d 09 61 6e 64 20 6d 65 |anagers,|..and me|
|00005490| 6e 75 73 2e 20 57 65 20 | 61 6c 73 6f 20 63 72 65 |nus. We |also cre|
|000054a0| 61 74 65 20 6f 75 72 20 | 6f 6e 65 20 61 70 70 6c |ate our |one appl|
|000054b0| 69 63 61 74 69 6f 6e 20 | 77 69 6e 64 6f 77 20 61 |ication |window a|
|000054c0| 74 20 74 68 69 73 20 74 | 69 6d 65 2e 0d 09 53 69 |t this t|ime...Si|
|000054d0| 6e 63 65 20 77 69 6e 64 | 6f 77 20 73 74 6f 72 61 |nce wind|ow stora|
|000054e0| 67 65 20 69 73 20 6e 6f | 6e 2d 72 65 6c 6f 63 61 |ge is no|n-reloca|
|000054f0| 74 65 61 62 6c 65 2c 20 | 68 6f 77 20 61 6e 64 20 |teable, |how and |
|00005500| 77 68 65 6e 20 74 6f 20 | 61 6c 6c 6f 63 61 74 65 |when to |allocate|
|00005510| 20 73 70 61 63 65 0d 09 | 66 6f 72 20 77 69 6e 64 | space..|for wind|
|00005520| 6f 77 73 20 69 73 20 76 | 65 72 79 20 69 6d 70 6f |ows is v|ery impo|
|00005530| 72 74 61 6e 74 20 73 6f | 20 74 68 61 74 20 68 65 |rtant so| that he|
|00005540| 61 70 20 66 72 61 67 6d | 65 6e 74 61 74 69 6f 6e |ap fragm|entation|
|00005550| 20 64 6f 65 73 20 6e 6f | 74 20 6f 63 63 75 72 2e | does no|t occur.|
|00005560| 0d 09 42 65 63 61 75 73 | 65 20 53 61 6d 70 6c 65 |..Becaus|e Sample|
|00005570| 20 68 61 73 20 6f 6e 6c | 79 20 6f 6e 65 20 77 69 | has onl|y one wi|
|00005580| 6e 64 6f 77 20 61 6e 64 | 20 69 74 20 69 73 20 6f |ndow and| it is o|
|00005590| 6e 6c 79 20 64 69 73 70 | 6f 73 65 64 20 77 68 65 |nly disp|osed whe|
|000055a0| 6e 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |n the ap|plicatio|
|000055b0| 6e 0d 09 71 75 69 74 73 | 2c 20 77 65 20 77 69 6c |n..quits|, we wil|
|000055c0| 6c 20 61 6c 6c 6f 63 61 | 74 65 20 69 74 73 20 73 |l alloca|te its s|
|000055d0| 70 61 63 65 20 68 65 72 | 65 2c 20 62 65 66 6f 72 |pace her|e, befor|
|000055e0| 65 20 61 6e 79 74 68 69 | 6e 67 20 74 68 61 74 20 |e anythi|ng that |
|000055f0| 6d 69 67 68 74 20 62 65 | 20 61 20 6c 6f 63 6b 65 |might be| a locke|
|00005600| 64 0d 09 72 65 6c 6f 63 | 61 74 61 62 6c 65 20 6f |d..reloc|atable o|
|00005610| 62 6a 65 63 74 20 67 65 | 74 73 20 69 6e 74 6f 20 |bject ge|ts into |
|00005620| 74 68 65 20 68 65 61 70 | 2e 20 54 68 69 73 20 77 |the heap|. This w|
|00005630| 61 79 2c 20 77 65 20 63 | 61 6e 20 66 6f 72 63 65 |ay, we c|an force|
|00005640| 20 74 68 65 20 73 74 6f | 72 61 67 65 20 74 6f 20 | the sto|rage to |
|00005650| 62 65 0d 09 69 6e 20 74 | 68 65 20 6c 6f 77 65 73 |be..in t|he lowes|
|00005660| 74 20 6d 65 6d 6f 72 79 | 20 61 76 61 69 6c 61 62 |t memory| availab|
|00005670| 6c 65 20 69 6e 20 74 68 | 65 20 68 65 61 70 2e 20 |le in th|e heap. |
|00005680| 57 69 6e 64 6f 77 20 73 | 74 6f 72 61 67 65 20 63 |Window s|torage c|
|00005690| 61 6e 20 64 69 66 66 65 | 72 20 77 69 64 65 6c 79 |an diffe|r widely|
|000056a0| 0d 09 61 6d 6f 6e 67 73 | 74 20 61 70 70 6c 69 63 |..amongs|t applic|
|000056b0| 61 74 69 6f 6e 73 20 64 | 65 70 65 6e 64 69 6e 67 |ations d|epending|
|000056c0| 20 6f 6e 20 68 6f 77 20 | 6d 61 6e 79 20 77 69 6e | on how |many win|
|000056d0| 64 6f 77 73 20 61 72 65 | 20 63 72 65 61 74 65 64 |dows are| created|
|000056e0| 20 61 6e 64 20 64 69 73 | 70 6f 73 65 64 2e 20 2a | and dis|posed. *|
|000056f0| 2f 0d 0d 2f 2a 09 31 2e | 30 31 20 2d 20 54 68 65 |/../*.1.|01 - The|
|00005700| 20 63 6f 64 65 20 74 68 | 61 74 20 75 73 65 64 20 | code th|at used |
|00005710| 74 6f 20 62 65 20 70 61 | 72 74 20 6f 66 20 46 6f |to be pa|rt of Fo|
|00005720| 72 63 65 45 6e 76 69 72 | 6f 6e 73 20 68 61 73 20 |rceEnvir|ons has |
|00005730| 62 65 65 6e 20 6d 6f 76 | 65 64 20 69 6e 74 6f 0d |been mov|ed into.|
|00005740| 09 74 68 69 73 20 6d 6f | 64 75 6c 65 2e 20 49 66 |.this mo|dule. If|
|00005750| 20 61 6e 20 65 72 72 6f | 72 20 69 73 20 64 65 74 | an erro|r is det|
|00005760| 65 63 74 65 64 2c 20 69 | 6e 73 74 65 61 64 20 6f |ected, i|nstead o|
|00005770| 66 20 6d 65 72 65 6c 79 | 20 64 6f 69 6e 67 20 61 |f merely| doing a|
|00005780| 6e 20 45 78 69 74 54 6f | 53 68 65 6c 6c 2c 0d 09 |n ExitTo|Shell,..|
|00005790| 77 68 69 63 68 20 6c 65 | 61 76 65 73 20 74 68 65 |which le|aves the|
|000057a0| 20 75 73 65 72 20 77 69 | 74 68 6f 75 74 20 6d 75 | user wi|thout mu|
|000057b0| 63 68 20 74 6f 20 67 6f | 20 6f 6e 2c 20 77 65 20 |ch to go| on, we |
|000057c0| 63 61 6c 6c 20 41 6c 65 | 72 74 55 73 65 72 2c 20 |call Ale|rtUser, |
|000057d0| 77 68 69 63 68 20 70 75 | 74 73 0d 09 75 70 20 61 |which pu|ts..up a|
|000057e0| 20 73 69 6d 70 6c 65 20 | 61 6c 65 72 74 20 74 68 | simple |alert th|
|000057f0| 61 74 20 6a 75 73 74 20 | 73 61 79 73 20 61 6e 20 |at just |says an |
|00005800| 65 72 72 6f 72 20 6f 63 | 63 75 72 72 65 64 20 61 |error oc|curred a|
|00005810| 6e 64 20 74 68 65 6e 20 | 63 61 6c 6c 73 20 45 78 |nd then |calls Ex|
|00005820| 69 74 54 6f 53 68 65 6c | 6c 2e 0d 09 53 69 6e 63 |itToShel|l...Sinc|
|00005830| 65 20 74 68 65 72 65 20 | 69 73 20 6e 6f 20 6f 74 |e there |is no ot|
|00005840| 68 65 72 20 63 6c 65 61 | 6e 75 70 20 6e 65 65 64 |her clea|nup need|
|00005850| 65 64 20 61 74 20 74 68 | 69 73 20 70 6f 69 6e 74 |ed at th|is point|
|00005860| 20 69 66 20 61 6e 20 65 | 72 72 6f 72 20 69 73 20 | if an e|rror is |
|00005870| 64 65 74 65 63 74 65 64 | 2c 0d 09 74 68 69 73 20 |detected|,..this |
|00005880| 66 6f 72 6d 20 6f 66 20 | 65 72 72 6f 72 2d 20 68 |form of |error- h|
|00005890| 61 6e 64 6c 69 6e 67 20 | 69 73 20 61 63 63 65 70 |andling |is accep|
|000058a0| 74 61 62 6c 65 2e 20 49 | 66 20 6d 6f 72 65 20 73 |table. I|f more s|
|000058b0| 6f 70 68 69 73 74 69 63 | 61 74 65 64 20 65 72 72 |ophistic|ated err|
|000058c0| 6f 72 20 72 65 63 6f 76 | 65 72 79 0d 09 69 73 20 |or recov|ery..is |
|000058d0| 6e 65 65 64 65 64 2c 20 | 61 6e 20 65 78 63 65 70 |needed, |an excep|
|000058e0| 74 69 6f 6e 20 6d 65 63 | 68 61 6e 69 73 6d 2c 20 |tion mec|hanism, |
|000058f0| 73 75 63 68 20 61 73 20 | 69 73 20 70 72 6f 76 69 |such as |is provi|
|00005900| 64 65 64 20 62 79 20 53 | 69 67 6e 61 6c 73 2c 20 |ded by S|ignals, |
|00005910| 63 61 6e 20 62 65 20 75 | 73 65 64 2e 20 2a 2f 0d |can be u|sed. */.|
|00005920| 0d 23 70 72 61 67 6d 61 | 20 73 65 67 6d 65 6e 74 |.#pragma| segment|
|00005930| 20 49 6e 69 74 69 61 6c | 69 7a 65 0d 76 6f 69 64 | Initial|ize.void|
|00005940| 20 49 6e 69 74 69 61 6c | 69 7a 65 28 77 69 6e 29 | Initial|ize(win)|
|00005950| 0d 57 69 6e 64 6f 77 50 | 74 72 20 2a 77 69 6e 3b |.WindowP|tr *win;|
|00005960| 0d 7b 0d 09 48 61 6e 64 | 6c 65 09 09 6d 65 6e 75 |.{..Hand|le..menu|
|00005970| 42 61 72 3b 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |Bar;..Wi|ndowPtr.|
|00005980| 77 69 6e 64 6f 77 3b 0d | 09 6c 6f 6e 67 09 09 74 |window;.|.long..t|
|00005990| 6f 74 61 6c 2c 20 63 6f | 6e 74 69 67 3b 0d 09 45 |otal, co|ntig;..E|
|000059a0| 76 65 6e 74 52 65 63 6f | 72 64 20 65 76 65 6e 74 |ventReco|rd event|
|000059b0| 3b 0d 09 73 68 6f 72 74 | 09 09 63 6f 75 6e 74 3b |;..short|..count;|
|000059c0| 0d 0d 09 67 49 6e 42 61 | 63 6b 67 72 6f 75 6e 64 |...gInBa|ckground|
|000059d0| 20 3d 20 66 61 6c 73 65 | 3b 0d 0d 09 49 6e 69 74 | = false|;...Init|
|000059e0| 47 72 61 66 28 28 50 74 | 72 29 20 26 71 64 2e 74 |Graf((Pt|r) &qd.t|
|000059f0| 68 65 50 6f 72 74 29 3b | 0d 09 49 6e 69 74 46 6f |hePort);|..InitFo|
|00005a00| 6e 74 73 28 29 3b 0d 09 | 49 6e 69 74 57 69 6e 64 |nts();..|InitWind|
|00005a10| 6f 77 73 28 29 3b 0d 09 | 49 6e 69 74 4d 65 6e 75 |ows();..|InitMenu|
|00005a20| 73 28 29 3b 0d 09 54 45 | 49 6e 69 74 28 29 3b 0d |s();..TE|Init();.|
|00005a30| 09 49 6e 69 74 44 69 61 | 6c 6f 67 73 28 6e 69 6c |.InitDia|logs(nil|
|00005a40| 29 3b 0d 09 49 6e 69 74 | 43 75 72 73 6f 72 28 29 |);..Init|Cursor()|
|00005a50| 3b 0d 09 0d 09 2f 2a 09 | 43 61 6c 6c 20 4d 50 50 |;..../*.|Call MPP|
|00005a60| 4f 70 65 6e 20 61 6e 64 | 20 41 54 50 4c 6f 61 64 |Open and| ATPLoad|
|00005a70| 20 61 74 20 74 68 69 73 | 20 70 6f 69 6e 74 20 74 | at this| point t|
|00005a80| 6f 20 69 6e 69 74 69 61 | 6c 69 7a 65 20 41 70 70 |o initia|lize App|
|00005a90| 6c 65 54 61 6c 6b 2c 0d | 09 20 09 69 66 20 79 6f |leTalk,.|. .if yo|
|00005aa0| 75 20 61 72 65 20 75 73 | 69 6e 67 20 69 74 2e 20 |u are us|ing it. |
|00005ab0| 2a 2f 0d 09 2f 2a 09 4e | 4f 54 45 20 2d 2d 20 49 |*/../*.N|OTE -- I|
|00005ac0| 74 20 69 73 20 6e 6f 20 | 6c 6f 6e 67 65 72 20 6e |t is no |longer n|
|00005ad0| 65 63 65 73 73 61 72 79 | 2c 20 61 6e 64 20 61 63 |ecessary|, and ac|
|00005ae0| 74 75 61 6c 6c 79 20 75 | 6e 68 65 61 6c 74 68 79 |tually u|nhealthy|
|00005af0| 2c 20 74 6f 20 63 68 65 | 63 6b 0d 09 09 50 6f 72 |, to che|ck...Por|
|00005b00| 74 42 55 73 65 20 61 6e | 64 20 53 50 43 6f 6e 66 |tBUse an|d SPConf|
|00005b10| 69 67 20 62 65 66 6f 72 | 65 20 6f 70 65 6e 69 6e |ig befor|e openin|
|00005b20| 67 20 41 70 70 6c 65 54 | 61 6c 6b 2e 20 54 68 65 |g AppleT|alk. The|
|00005b30| 20 64 72 69 76 65 72 73 | 20 61 72 65 20 63 61 70 | drivers| are cap|
|00005b40| 61 62 6c 65 0d 09 09 6f | 66 20 63 68 65 63 6b 69 |able...o|f checki|
|00005b50| 6e 67 20 66 6f 72 20 70 | 6f 72 74 20 61 76 61 69 |ng for p|ort avai|
|00005b60| 6c 61 62 69 6c 69 74 79 | 20 74 68 65 6d 73 65 6c |lability| themsel|
|00005b70| 76 65 73 2e 20 2a 2f 0d | 09 0d 09 2f 2a 09 54 68 |ves. */.|.../*.Th|
|00005b80| 69 73 20 6e 65 78 74 20 | 62 69 74 20 6f 66 20 63 |is next |bit of c|
|00005b90| 6f 64 65 20 69 73 20 6e | 65 63 65 73 73 61 72 79 |ode is n|ecessary|
|00005ba0| 20 74 6f 20 61 6c 6c 6f | 77 20 74 68 65 20 64 65 | to allo|w the de|
|00005bb0| 66 61 75 6c 74 20 62 75 | 74 74 6f 6e 20 6f 66 20 |fault bu|tton of |
|00005bc0| 6f 75 72 0d 09 09 61 6c | 65 72 74 20 62 65 20 6f |our...al|ert be o|
|00005bd0| 75 74 6c 69 6e 65 64 2e | 0d 09 09 31 2e 30 32 20 |utlined.|...1.02 |
|00005be0| 2d 20 43 68 61 6e 67 65 | 64 20 74 6f 20 63 61 6c |- Change|d to cal|
|00005bf0| 6c 20 45 76 65 6e 74 41 | 76 61 69 6c 20 73 6f 20 |l EventA|vail so |
|00005c00| 74 68 61 74 20 77 65 20 | 64 6f 6e 27 74 20 6c 6f |that we |don't lo|
|00005c10| 73 65 20 73 6f 6d 65 20 | 69 6d 70 6f 72 74 61 6e |se some |importan|
|00005c20| 74 0d 09 09 65 76 65 6e | 74 73 2e 20 2a 2f 0d 09 |t...even|ts. */..|
|00005c30| 20 0d 09 66 6f 72 20 28 | 63 6f 75 6e 74 20 3d 20 | ..for (|count = |
|00005c40| 31 3b 20 63 6f 75 6e 74 | 20 3c 3d 20 33 3b 20 63 |1; count| <= 3; c|
|00005c50| 6f 75 6e 74 2b 2b 29 0d | 09 09 45 76 65 6e 74 41 |ount++).|..EventA|
|00005c60| 76 61 69 6c 28 65 76 65 | 72 79 45 76 65 6e 74 2c |vail(eve|ryEvent,|
|00005c70| 20 26 65 76 65 6e 74 29 | 3b 0d 09 0d 09 2f 2a 09 | &event)|;..../*.|
|00005c80| 49 67 6e 6f 72 65 20 74 | 68 65 20 65 72 72 6f 72 |Ignore t|he error|
|00005c90| 20 72 65 74 75 72 6e 65 | 64 20 66 72 6f 6d 20 53 | returne|d from S|
|00005ca0| 79 73 45 6e 76 69 72 6f | 6e 73 3b 20 65 76 65 6e |ysEnviro|ns; even|
|00005cb0| 20 69 66 20 61 6e 20 65 | 72 72 6f 72 20 6f 63 63 | if an e|rror occ|
|00005cc0| 75 72 72 65 64 2c 0d 09 | 09 74 68 65 20 53 79 73 |urred,..|.the Sys|
|00005cd0| 45 6e 76 69 72 6f 6e 73 | 20 67 6c 75 65 20 77 69 |Environs| glue wi|
|00005ce0| 6c 6c 20 66 69 6c 6c 20 | 69 6e 20 74 68 65 20 53 |ll fill |in the S|
|00005cf0| 79 73 45 6e 76 52 65 63 | 2e 20 59 6f 75 20 63 61 |ysEnvRec|. You ca|
|00005d00| 6e 20 73 61 76 65 20 61 | 20 72 65 64 75 6e 64 61 |n save a| redunda|
|00005d10| 6e 74 0d 09 09 63 61 6c | 6c 20 74 6f 20 53 79 73 |nt...cal|l to Sys|
|00005d20| 45 6e 76 69 72 6f 6e 73 | 20 62 79 20 63 61 6c 6c |Environs| by call|
|00005d30| 69 6e 67 20 69 74 20 61 | 66 74 65 72 20 69 6e 69 |ing it a|fter ini|
|00005d40| 74 69 61 6c 69 7a 69 6e | 67 20 41 70 70 6c 65 54 |tializin|g AppleT|
|00005d50| 61 6c 6b 2e 20 2a 2f 0d | 09 20 0d 09 53 79 73 45 |alk. */.|. ..SysE|
|00005d60| 6e 76 69 72 6f 6e 73 28 | 6b 53 79 73 45 6e 76 69 |nvirons(|kSysEnvi|
|00005d70| 72 6f 6e 73 56 65 72 73 | 69 6f 6e 2c 20 26 67 4d |ronsVers|ion, &gM|
|00005d80| 61 63 29 3b 0d 09 0d 09 | 2f 2a 20 4d 61 6b 65 20 |ac);....|/* Make |
|00005d90| 73 75 72 65 20 74 68 61 | 74 20 74 68 65 20 6d 61 |sure tha|t the ma|
|00005da0| 63 68 69 6e 65 20 68 61 | 73 20 61 74 20 6c 65 61 |chine ha|s at lea|
|00005db0| 73 74 20 31 32 38 4b 20 | 52 4f 4d 73 2e 20 49 66 |st 128K |ROMs. If|
|00005dc0| 20 69 74 20 64 6f 65 73 | 6e 27 74 2c 20 65 78 69 | it does|n't, exi|
|00005dd0| 74 2e 20 2a 2f 0d 09 0d | 09 69 66 20 28 67 4d 61 |t. */...|.if (gMa|
|00005de0| 63 2e 6d 61 63 68 69 6e | 65 54 79 70 65 20 3c 20 |c.machin|eType < |
|00005df0| 30 29 20 41 6c 65 72 74 | 55 73 65 72 28 29 3b 0d |0) Alert|User();.|
|00005e00| 09 0d 09 2f 2a 09 31 2e | 30 32 20 2d 20 4d 6f 76 |.../*.1.|02 - Mov|
|00005e10| 65 20 54 72 61 70 41 76 | 61 69 6c 61 62 6c 65 20 |e TrapAv|ailable |
|00005e20| 63 61 6c 6c 20 74 6f 20 | 61 66 74 65 72 20 53 79 |call to |after Sy|
|00005e30| 73 45 6e 76 69 72 6f 6e | 73 20 73 6f 20 74 68 61 |sEnviron|s so tha|
|00005e40| 74 20 77 65 20 63 61 6e | 20 74 65 6c 6c 0d 09 09 |t we can| tell...|
|00005e50| 69 6e 20 54 72 61 70 41 | 76 61 69 6c 61 62 6c 65 |in TrapA|vailable|
|00005e60| 20 69 66 20 61 20 74 6f | 6f 6c 20 74 72 61 70 20 | if a to|ol trap |
|00005e70| 76 61 6c 75 65 20 69 73 | 20 6f 75 74 20 6f 66 20 |value is| out of |
|00005e80| 72 61 6e 67 65 2e 20 2a | 2f 0d 09 09 0d 09 67 48 |range. *|/.....gH|
|00005e90| 61 73 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 20 |asWaitNe|xtEvent |
|00005ea0| 3d 20 54 72 61 70 41 76 | 61 69 6c 61 62 6c 65 28 |= TrapAv|ailable(|
|00005eb0| 5f 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 2c 20 |_WaitNex|tEvent, |
|00005ec0| 54 6f 6f 6c 54 72 61 70 | 29 3b 0d 0d 09 2f 2a 09 |ToolTrap|);.../*.|
|00005ed0| 31 2e 30 31 20 2d 20 57 | 65 20 75 73 65 64 20 74 |1.01 - W|e used t|
|00005ee0| 6f 20 6d 61 6b 65 20 61 | 20 63 68 65 63 6b 20 66 |o make a| check f|
|00005ef0| 6f 72 20 6d 65 6d 6f 72 | 79 20 61 74 20 74 68 69 |or memor|y at thi|
|00005f00| 73 20 70 6f 69 6e 74 20 | 62 79 20 65 78 61 6d 69 |s point |by exami|
|00005f10| 6e 69 6e 67 20 41 70 70 | 6c 4c 69 6d 69 74 2c 0d |ning App|lLimit,.|
|00005f20| 09 09 41 70 70 6c 69 63 | 5a 6f 6e 65 2c 20 61 6e |..Applic|Zone, an|
|00005f30| 64 20 53 74 61 63 6b 53 | 70 61 63 65 20 61 6e 64 |d StackS|pace and|
|00005f40| 20 63 6f 6d 70 61 72 69 | 6e 67 20 74 68 61 74 20 | compari|ng that |
|00005f50| 74 6f 20 74 68 65 20 6d | 69 6e 69 6d 75 6d 20 73 |to the m|inimum s|
|00005f60| 69 7a 65 20 77 65 20 74 | 6f 6c 64 0d 09 09 4d 75 |ize we t|old...Mu|
|00005f70| 6c 74 69 46 69 6e 64 65 | 72 20 77 65 20 6e 65 65 |ltiFinde|r we nee|
|00005f80| 64 65 64 2e 20 54 68 69 | 73 20 64 69 64 20 6e 6f |ded. Thi|s did no|
|00005f90| 74 20 77 6f 72 6b 20 77 | 65 6c 6c 20 62 65 63 61 |t work w|ell beca|
|00005fa0| 75 73 65 20 69 74 20 61 | 73 73 75 6d 65 64 20 74 |use it a|ssumed t|
|00005fb0| 6f 6f 20 6d 75 63 68 20 | 61 62 6f 75 74 0d 09 09 |oo much |about...|
|00005fc0| 74 68 65 20 72 65 6c 61 | 74 69 6f 6e 73 68 69 70 |the rela|tionship|
|00005fd0| 20 62 65 74 77 65 65 6e | 20 77 68 61 74 20 77 65 | between| what we|
|00005fe0| 20 61 73 6b 65 64 20 4d | 75 6c 74 69 46 69 6e 64 | asked M|ultiFind|
|00005ff0| 65 72 20 66 6f 72 20 61 | 6e 64 20 77 68 61 74 20 |er for a|nd what |
|00006000| 77 65 20 77 6f 75 6c 64 | 20 61 63 74 75 61 6c 6c |we would| actuall|
|00006010| 79 0d 09 09 67 65 74 20 | 62 61 63 6b 2c 20 61 73 |y...get |back, as|
|00006020| 20 77 65 6c 6c 20 61 73 | 20 68 6f 77 20 74 6f 20 | well as| how to |
|00006030| 6d 65 61 73 75 72 65 20 | 69 74 2e 20 49 6e 73 74 |measure |it. Inst|
|00006040| 65 61 64 2c 20 77 65 20 | 77 69 6c 6c 20 75 73 65 |ead, we |will use|
|00006050| 20 61 6e 20 61 6c 74 65 | 72 6e 61 74 65 0d 09 09 | an alte|rnate...|
|00006060| 6d 65 74 68 6f 64 20 63 | 6f 6d 70 72 69 73 65 64 |method c|omprised|
|00006070| 20 6f 66 20 74 77 6f 20 | 73 74 65 70 73 2e 20 2a | of two |steps. *|
|00006080| 2f 0d 09 20 0d 09 2f 2a | 09 49 74 20 69 73 20 62 |/.. ../*|.It is b|
|00006090| 65 74 74 65 72 20 74 6f | 20 66 69 72 73 74 20 63 |etter to| first c|
|000060a0| 68 65 63 6b 20 74 68 65 | 20 73 69 7a 65 20 6f 66 |heck the| size of|
|000060b0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|000060c0| 20 68 65 61 70 20 61 67 | 61 69 6e 73 74 20 61 20 | heap ag|ainst a |
|000060d0| 76 61 6c 75 65 0d 09 09 | 74 68 61 74 20 79 6f 75 |value...|that you|
|000060e0| 20 68 61 76 65 20 64 65 | 74 65 72 6d 69 6e 65 64 | have de|termined|
|000060f0| 20 69 73 20 74 68 65 20 | 73 6d 61 6c 6c 65 73 74 | is the |smallest|
|00006100| 20 68 65 61 70 20 74 68 | 65 20 61 70 70 6c 69 63 | heap th|e applic|
|00006110| 61 74 69 6f 6e 20 63 61 | 6e 20 72 65 61 73 6f 6e |ation ca|n reason|
|00006120| 61 62 6c 79 0d 09 09 77 | 6f 72 6b 20 69 6e 2e 20 |ably...w|ork in. |
|00006130| 54 68 69 73 20 6e 75 6d | 62 65 72 20 73 68 6f 75 |This num|ber shou|
|00006140| 6c 64 20 62 65 20 64 65 | 72 69 76 65 64 20 62 79 |ld be de|rived by|
|00006150| 20 65 78 61 6d 69 6e 69 | 6e 67 20 74 68 65 20 73 | examini|ng the s|
|00006160| 69 7a 65 20 6f 66 20 74 | 68 65 20 68 65 61 70 20 |ize of t|he heap |
|00006170| 74 68 61 74 0d 09 09 69 | 73 20 61 63 74 75 61 6c |that...i|s actual|
|00006180| 6c 79 20 70 72 6f 76 69 | 64 65 64 20 62 79 20 4d |ly provi|ded by M|
|00006190| 75 6c 74 69 46 69 6e 64 | 65 72 20 77 68 65 6e 20 |ultiFind|er when |
|000061a0| 74 68 65 20 6d 69 6e 69 | 6d 75 6d 20 73 69 7a 65 |the mini|mum size|
|000061b0| 20 72 65 71 75 65 73 74 | 65 64 20 69 73 20 75 73 | request|ed is us|
|000061c0| 65 64 2e 0d 09 09 54 68 | 65 20 64 65 72 69 76 61 |ed....Th|e deriva|
|000061d0| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 6d 69 6e 69 |tion of |the mini|
|000061e0| 6d 75 6d 20 73 69 7a 65 | 20 72 65 71 75 65 73 74 |mum size| request|
|000061f0| 65 64 20 66 72 6f 6d 20 | 4d 75 6c 74 69 46 69 6e |ed from |MultiFin|
|00006200| 64 65 72 20 69 73 20 64 | 65 73 63 72 69 62 65 64 |der is d|escribed|
|00006210| 0d 09 09 69 6e 20 53 61 | 6d 70 6c 65 2e 68 2e 20 |...in Sa|mple.h. |
|00006220| 54 68 65 20 63 68 65 63 | 6b 20 73 68 6f 75 6c 64 |The chec|k should|
|00006230| 20 62 65 20 6d 61 64 65 | 20 62 65 63 61 75 73 65 | be made| because|
|00006240| 20 74 68 65 20 70 72 65 | 66 65 72 72 65 64 20 73 | the pre|ferred s|
|00006250| 69 7a 65 20 63 61 6e 20 | 65 6e 64 20 75 70 0d 09 |ize can |end up..|
|00006260| 09 62 65 69 6e 67 20 73 | 65 74 20 73 6d 61 6c 6c |.being s|et small|
|00006270| 65 72 20 74 68 61 6e 20 | 74 68 65 20 6d 69 6e 69 |er than |the mini|
|00006280| 6d 75 6d 20 73 69 7a 65 | 20 62 79 20 74 68 65 20 |mum size| by the |
|00006290| 75 73 65 72 2e 20 54 68 | 69 73 20 65 78 74 72 61 |user. Th|is extra|
|000062a0| 20 63 68 65 63 6b 20 61 | 63 74 73 20 74 6f 0d 09 | check a|cts to..|
|000062b0| 09 69 6e 73 75 72 65 20 | 74 68 61 74 20 79 6f 75 |.insure |that you|
|000062c0| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 69 73 |r applic|ation is|
|000062d0| 20 73 74 61 72 74 69 6e | 67 20 66 72 6f 6d 20 61 | startin|g from a|
|000062e0| 20 73 6f 6c 69 64 20 6d | 65 6d 6f 72 79 20 66 6f | solid m|emory fo|
|000062f0| 75 6e 64 61 74 69 6f 6e | 2e 20 2a 2f 0d 09 20 0d |undation|. */.. .|
|00006300| 09 69 66 20 28 28 6c 6f | 6e 67 29 20 47 65 74 41 |.if ((lo|ng) GetA|
|00006310| 70 70 6c 4c 69 6d 69 74 | 28 29 20 2d 20 28 6c 6f |pplLimit|() - (lo|
|00006320| 6e 67 29 20 41 70 70 6c | 69 63 5a 6f 6e 65 28 29 |ng) Appl|icZone()|
|00006330| 20 3c 20 6b 4d 69 6e 48 | 65 61 70 29 20 41 6c 65 | < kMinH|eap) Ale|
|00006340| 72 74 55 73 65 72 28 29 | 3b 0d 09 0d 09 2f 2a 09 |rtUser()|;..../*.|
|00006350| 4e 65 78 74 2c 20 6d 61 | 6b 65 20 73 75 72 65 20 |Next, ma|ke sure |
|00006360| 74 68 61 74 20 65 6e 6f | 75 67 68 20 6d 65 6d 6f |that eno|ugh memo|
|00006370| 72 79 20 69 73 20 66 72 | 65 65 20 66 6f 72 20 79 |ry is fr|ee for y|
|00006380| 6f 75 72 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |our appl|ication |
|00006390| 74 6f 20 72 75 6e 2e 20 | 49 74 0d 09 09 69 73 20 |to run. |It...is |
|000063a0| 70 6f 73 73 69 62 6c 65 | 20 66 6f 72 20 61 20 73 |possible| for a s|
|000063b0| 69 74 75 61 74 69 6f 6e | 20 74 6f 20 61 72 69 73 |ituation| to aris|
|000063c0| 65 20 77 68 65 72 65 20 | 74 68 65 20 68 65 61 70 |e where |the heap|
|000063d0| 20 6d 61 79 20 68 61 76 | 65 20 62 65 65 6e 20 6f | may hav|e been o|
|000063e0| 66 20 72 65 71 75 69 72 | 65 64 0d 09 09 73 69 7a |f requir|ed...siz|
|000063f0| 65 2c 20 62 75 74 20 61 | 20 6c 61 72 67 65 20 73 |e, but a| large s|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.